Android Open Source - mobile2-android Profile Activity






From Project

Back to project page mobile2-android.

License

The source code is released under:

Apache License

If you think the Android project mobile2-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ecollege.android;
//  w  ww  .j ava2s  .  c o m
import java.util.List;

import roboguice.inject.InjectView;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.ecollege.android.activities.ECollegeListActivity;
import com.ecollege.android.adapter.UberAdapter;
import com.ecollege.android.adapter.UberItem;
import com.ecollege.api.ECollegeClient;
import com.ecollege.api.model.Course;
import com.google.inject.Inject;

public class ProfileActivity extends ECollegeListActivity {
    @InjectView(R.id.name_text) TextView nameText;
    @InjectView(R.id.sign_out_button) Button signOutButton;
  @Inject ECollegeApplication app;
  @Inject SharedPreferences prefs;
  protected ECollegeClient client;
  private CourseArrayAdapter courseAdapter;
  private List<Course> courses;
  public LayoutInflater viewInflater;
  
    @Override public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.profile);
        client = app.getClient();
        courses = app.getCurrentCourseList();
        viewInflater = getLayoutInflater();

        nameText.setText(app.getCurrentUser().getFirstName() + " " + app.getCurrentUser().getLastName());
        
        signOutButton.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        signOut();
      }
    });
        
        courseAdapter = new CourseArrayAdapter(this);
        courseAdapter.updateItems(courses);
        setListAdapter(courseAdapter);
    }

  protected void signOut() {
    app.logout();
  }

  protected class CourseViewHolder {
    public TextView courseTitleText;
    public TextView courseDescriptionText;
  }
  
  protected class CourseArrayAdapter extends UberAdapter<Course> {

    public CourseArrayAdapter(Context context) {
      super(context, false, false, false);
    }
    
    @Override
    public boolean areAllItemsEnabled() {
      return false;
    }
    @Override
    public boolean isEnabled(int position) {
      return false;
    }
    
    @Override
    protected View getDataItemView(View convertView, ViewGroup parent,
        UberItem<Course> item) {
      CourseViewHolder holder;
      if (convertView == null) {
        convertView = viewInflater.inflate(R.layout.simple_course_list_item, null);
        holder = new CourseViewHolder();
        holder.courseTitleText = (TextView) convertView.findViewById(R.id.course_title);
        holder.courseDescriptionText = (TextView) convertView.findViewById(R.id.course_code_text);
        convertView.setTag(holder);
      } else {
        holder = (CourseViewHolder) convertView.getTag();
      }
      
      Course course = item.getDataItem();
      holder.courseTitleText.setText(Html.fromHtml(course.getTitle()));
      holder.courseDescriptionText.setText(course.getDisplayCourseCode());
      
      return convertView;
    }
    
  }

  
}




Java Source Code List

com.ecollege.android.AnnouncementActivity.java
com.ecollege.android.CourseActivity.java
com.ecollege.android.CourseAnnouncementsActivity.java
com.ecollege.android.CourseDiscussionsActivity.java
com.ecollege.android.CourseGradebookActivity.java
com.ecollege.android.CoursePeopleActivity.java
com.ecollege.android.CourseThreadActivity.java
com.ecollege.android.CoursesActivity.java
com.ecollege.android.DiscussionsActivity.java
com.ecollege.android.DropboxMessageActivity.java
com.ecollege.android.ECollegeApplication.java
com.ecollege.android.GradeActivity.java
com.ecollege.android.HomeActivity.java
com.ecollege.android.HtmlContentActivity.java
com.ecollege.android.LoginActivity.java
com.ecollege.android.MainActivity.java
com.ecollege.android.PersonActivity.java
com.ecollege.android.ProfileActivity.java
com.ecollege.android.SingleSignonActivity.java
com.ecollege.android.SplashActivity.java
com.ecollege.android.UserDiscussionActivity.java
com.ecollege.android.UserResponseActivity.java
com.ecollege.android.UserTopicActivity.java
com.ecollege.android.activities.ECollegeActivityHelper.java
com.ecollege.android.activities.ECollegeActivity.java
com.ecollege.android.activities.ECollegeDefaultActivity.java
com.ecollege.android.activities.ECollegeListActivity.java
com.ecollege.android.activities.ECollegeTabActivity.java
com.ecollege.android.adapter.ActivityFeedAdapter.java
com.ecollege.android.adapter.GroupedAdapter.java
com.ecollege.android.adapter.LoadMoreAdapter.java
com.ecollege.android.adapter.ParentAdapterObserver.java
com.ecollege.android.adapter.ResponseAdapter.java
com.ecollege.android.adapter.TopicsAdapter.java
com.ecollege.android.adapter.UberAdapter.java
com.ecollege.android.adapter.UberItem.java
com.ecollege.android.adapter.UpcomingEventsAdapter.java
com.ecollege.android.adapter.WaitingForApiAdapter.java
com.ecollege.android.errors.ECollegeAlertException.java
com.ecollege.android.errors.ECollegeException.java
com.ecollege.android.errors.ECollegePromptException.java
com.ecollege.android.errors.ECollegePromptRetryException.java
com.ecollege.android.tasks.ECollegeAsyncTask.java
com.ecollege.android.tasks.ServiceCallTask.java
com.ecollege.android.tasks.TaskPostProcessor.java
com.ecollege.android.util.CacheConfiguration.java
com.ecollege.android.util.DateTimeUtil.java
com.ecollege.android.util.FileCacheManager.java
com.ecollege.android.util.VolatileCacheManager.java
com.ecollege.android.view.HeaderView.java
com.ecollege.android.view.helpers.ResponseCountViewHelper.java