public class SettingsActivity extends DrawerActivity implements NetworkSummaryAdapter.OnNetworkTapListener
DrawerActivity.WaitForSubscribedList
Modifier and Type | Field and Description |
---|---|
(package private) android.widget.EditText |
bio
Editable text fields that make up parts of the
User 's profile |
(package private) android.widget.EditText |
email
Editable text fields that make up parts of the
User 's profile |
(package private) android.widget.TextView |
emptyText
Text field that displays
R.string#no_networks if the user has not joined any
Network s |
(package private) android.widget.EditText |
firstName
Editable text fields that make up parts of the
User 's profile |
(package private) android.widget.EditText |
lastName
Editable text fields that make up parts of the
User 's profile |
private android.widget.FrameLayout |
loadingOverlay |
(package private) long |
MAX_PIXELS
The max number of pixels for an image given the image.
|
(package private) int |
MAX_QUALITY
Constant that clarifies that quality 100 means no compression.
|
(package private) double |
MAX_SIDE
The maximum number of pixels allowed on a single side of an image
|
private static int |
PICK_IMAGE
The
requestCode used if the user was asked to pick an image from their gallery. |
(package private) android.widget.ImageView |
profilePicture
The field for the
User 's profile picture |
(package private) RequestQueue |
queue
Queue for asynchronous tasks
|
(package private) RecyclerView |
rv |
(package private) android.widget.ScrollView |
scrollView
The user whose profile is displayed and being edited
|
private static java.lang.String |
TAG
Tag for log statements
|
(package private) android.widget.Button |
updateProfile
Button for updating the
User 's profile on the server with the one currently displayed |
(package private) com.culturemesh.android.models.User |
user |
(package private) android.widget.EditText |
userName
Editable text fields that make up parts of the
User 's profile |
currentUser, frameLayout, fullLayout, mDrawerLayout, mDrawerToggle, mToolbar, navView, subscribedNetworkIds, subscribedNetworks, thisActivity
Constructor and Description |
---|
SettingsActivity() |
Modifier and Type | Method and Description |
---|---|
protected void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
This function is overridden to handle image selection.
|
protected void |
onCreate(android.os.Bundle savedInstanceState)
Setup the user interface with the layout defined in
R.layout#activity_settings . |
void |
onItemClick(android.view.View v,
com.culturemesh.android.models.Network network)
Handle what happens when a user clicks on a
Network . |
void |
onStop()
This ensures that we are canceling all network requests if the user is leaving this activity.
|
(package private) void |
resetAdapter()
Reset the adapter by clearing it and then populating it with new information from
API.Get#userNetworks(RequestQueue, long, Response.Listener) ,
API.Get#networkPostCount(RequestQueue, long, Response.Listener) , and
API.Get#networkUserCount(RequestQueue, long, Response.Listener) . |
private android.graphics.Bitmap |
resizeBitmap(android.graphics.Bitmap bitmap)
Resizes bitmap to ensure that bitmap fits under 2 MB limit.
|
void |
updateUser(android.content.SharedPreferences settings)
Updates user info via PUT request to server.
|
fetchNetworks, onConfigurationChanged, onNavigationItemSelected, onPostCreate, setContentView
RecyclerView rv
android.widget.TextView emptyText
R.string#no_networks
if the user has not joined any
Network
sandroid.widget.EditText bio
User
's profileandroid.widget.EditText firstName
User
's profileandroid.widget.EditText lastName
User
's profileandroid.widget.EditText userName
User
's profileandroid.widget.EditText email
User
's profileandroid.widget.ImageView profilePicture
User
's profile pictureandroid.widget.Button updateProfile
User
's profile on the server with the one currently displayedandroid.widget.ScrollView scrollView
private android.widget.FrameLayout loadingOverlay
com.culturemesh.android.models.User user
RequestQueue queue
private static final java.lang.String TAG
private static final int PICK_IMAGE
requestCode
used if the user was asked to pick an image from their gallery.final int MAX_QUALITY
final long MAX_PIXELS
final double MAX_SIDE
protected void onActivityResult(int requestCode, int resultCode, android.content.Intent data)
requestCode
- PICK_IMAGE if we asked them to choose an image from the gallery.resultCode
- data
- Hopefully, the URI.private android.graphics.Bitmap resizeBitmap(android.graphics.Bitmap bitmap)
bitmap
- protected void onCreate(android.os.Bundle savedInstanceState)
R.layout#activity_settings
. Also
initialize instance fields for UI fields with the elements defined in the layout file. Fill
the fields with the current profile (fetched using
API.Get#user(RequestQueue, long, Response.Listener)
). Link listeners to buttons
and the displays of Network
s to handle interactions.savedInstanceState
- public void onItemClick(android.view.View v, com.culturemesh.android.models.Network network)
Network
. Right now, nothing is done.onItemClick
in interface NetworkSummaryAdapter.OnNetworkTapListener
v
- network
- void resetAdapter()
API.Get#userNetworks(RequestQueue, long, Response.Listener)
,
API.Get#networkPostCount(RequestQueue, long, Response.Listener)
, and
API.Get#networkUserCount(RequestQueue, long, Response.Listener)
.public void onStop()
onStop
in class DrawerActivity
public void updateUser(android.content.SharedPreferences settings)
settings
- SharedPreferences instance to save email.