-
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 #2 from Fayte92/Arin
Arin
- Loading branch information
Showing
31 changed files
with
644 additions
and
124 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
59 changes: 59 additions & 0 deletions
59
WinRate/app/src/main/java/com/ucsc/winrate/ui/contactBook/ContactBookFragment.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,59 @@ | ||
package com.ucsc.winrate.ui.contactBook; | ||
|
||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.lifecycle.Observer; | ||
import androidx.lifecycle.ViewModelProviders; | ||
import androidx.navigation.NavController; | ||
import androidx.navigation.Navigation; | ||
|
||
import com.ucsc.winrate.R; | ||
|
||
public class ContactBookFragment extends Fragment implements View.OnClickListener { | ||
|
||
private ContactBookViewModel contactBookViewModel; | ||
private Button contactsButton; | ||
private Button decksButton; | ||
|
||
public View onCreateView(@NonNull LayoutInflater inflater, | ||
ViewGroup container, Bundle savedInstanceState) { | ||
contactBookViewModel = | ||
ViewModelProviders.of(this).get(ContactBookViewModel.class); | ||
View root = inflater.inflate(R.layout.fragment_contact_book, container, false); | ||
|
||
contactsButton = root.findViewById(R.id.contactsButton); | ||
contactsButton.setOnClickListener(this); | ||
decksButton = root.findViewById(R.id.decksButton); | ||
decksButton.setOnClickListener(this); | ||
//final TextView textView = root.findViewById(R.id.text_contactBook); | ||
//contactBookViewModel.getText().observe(this, new Observer<String>() { | ||
// @Override | ||
// public void onChanged(@Nullable String s) { | ||
// textView.setText(s); | ||
// } | ||
//}); | ||
return root; | ||
} | ||
|
||
@Override | ||
public void onClick(View view) { | ||
NavController navController = Navigation.findNavController(getActivity(), R.id.nav_host_contact_fragment); | ||
switch (view.getId()) { | ||
case R.id.contactsButton: | ||
navController.navigate(R.id.navContacts); | ||
break; | ||
case R.id.decksButton: | ||
navController.navigate(R.id.navDecks); | ||
break; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
WinRate/app/src/main/java/com/ucsc/winrate/ui/contactBook/ContactBookViewModel.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,19 @@ | ||
package com.ucsc.winrate.ui.contactBook; | ||
|
||
import androidx.lifecycle.LiveData; | ||
import androidx.lifecycle.MutableLiveData; | ||
import androidx.lifecycle.ViewModel; | ||
|
||
public class ContactBookViewModel extends ViewModel{ | ||
|
||
private MutableLiveData<String> mText; | ||
|
||
public ContactBookViewModel() { | ||
mText = new MutableLiveData<>(); | ||
mText.setValue("Contact Book"); | ||
} | ||
|
||
public LiveData<String> getText() { | ||
return mText; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
WinRate/app/src/main/java/com/ucsc/winrate/ui/contactBook/ContactsFragment.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,32 @@ | ||
package com.ucsc.winrate.ui.contactBook; | ||
|
||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.lifecycle.ViewModelProviders; | ||
|
||
import com.ucsc.winrate.R; | ||
|
||
public class ContactsFragment extends Fragment{ | ||
|
||
private ContactsViewModel contactsViewModel; | ||
|
||
public View onCreateView(@NonNull LayoutInflater inflater, | ||
ViewGroup container, Bundle savedInstanceState) { | ||
contactsViewModel = | ||
ViewModelProviders.of(this).get(ContactsViewModel.class); | ||
View root = inflater.inflate(R.layout.fragment_contacts, container, false); | ||
//final TextView textView = root.findViewById(R.id.text_contacts); | ||
//contactsViewModel.getText().observe(this, new Observer<String>() { | ||
// @Override | ||
// public void onChanged(@Nullable String s) { | ||
// textView.setText(s); | ||
// } | ||
//}); | ||
return root; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
WinRate/app/src/main/java/com/ucsc/winrate/ui/contactBook/ContactsViewModel.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,19 @@ | ||
package com.ucsc.winrate.ui.contactBook; | ||
|
||
import androidx.lifecycle.LiveData; | ||
import androidx.lifecycle.MutableLiveData; | ||
import androidx.lifecycle.ViewModel; | ||
|
||
public class ContactsViewModel extends ViewModel{ | ||
|
||
private MutableLiveData<String> mText; | ||
|
||
public ContactsViewModel() { | ||
mText = new MutableLiveData<>(); | ||
mText.setValue("Contacts"); | ||
} | ||
|
||
public LiveData<String> getText() { | ||
return mText; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
WinRate/app/src/main/java/com/ucsc/winrate/ui/contactBook/DecksFragment.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,32 @@ | ||
package com.ucsc.winrate.ui.contactBook; | ||
|
||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.lifecycle.ViewModelProviders; | ||
|
||
import com.ucsc.winrate.R; | ||
|
||
public class DecksFragment extends Fragment{ | ||
|
||
private DecksViewModel decksViewModel; | ||
|
||
public View onCreateView(@NonNull LayoutInflater inflater, | ||
ViewGroup container, Bundle savedInstanceState) { | ||
decksViewModel = | ||
ViewModelProviders.of(this).get(DecksViewModel.class); | ||
View root = inflater.inflate(R.layout.fragment_decks, container, false); | ||
//final TextView textView = root.findViewById(R.id.text_decks); | ||
//decksViewModel.getText().observe(this, new Observer<String>() { | ||
// @Override | ||
// public void onChanged(@Nullable String s) { | ||
// textView.setText(s); | ||
// } | ||
//}); | ||
return root; | ||
} | ||
} |
Oops, something went wrong.