Exemplo n.º 1
0
 private void setActionBarTitle() {
   MySong currentSong = App.mClementine.getCurrentSong();
   if (currentSong == null) {
     mActionBar.setTitle(getString(R.string.player_nosong));
     mActionBar.setSubtitle("");
   } else {
     mActionBar.setTitle(currentSong.getArtist());
     mActionBar.setSubtitle(currentSong.getTitle());
   }
 }
Exemplo n.º 2
0
 private void prepareActionBar() {
   ActionBar mActionBar = getSupportActionBar();
   mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
   mActionBar.setDisplayHomeAsUpEnabled(true);
   mActionBar.setDisplayShowHomeEnabled(false);
   mActionBar.setTitle(R.string.local);
 }
Exemplo n.º 3
0
 public void setupActionBar() {
   final ActionBar actionBar = getSupportActionBar();
   actionBar.setHomeButtonEnabled(true);
   actionBar.setDisplayShowTitleEnabled(true);
   String currentSprite = ProjectManager.getInstance().getCurrentSprite().getName();
   actionBar.setTitle(currentSprite);
 }
Exemplo n.º 4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about_screen);

    stylefont = Typeface.createFromAsset(getAssets(), AppConstants.fontStyle);
    actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("About");

    fontActionBar(actionBar.getTitle().toString());

    actionBar.setIcon(android.R.drawable.ic_menu_info_details);

    if (isNetworkAvailable()) {
      new GetAbout(this).execute();
    } else {
      Toast.makeText(this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
    }
    about = (TextView) findViewById(R.id.about_text);
    developed = (TextView) findViewById(R.id.developed);
    developed.setTypeface(stylefont);
    about.setTypeface(stylefont);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setIcon(android.R.color.transparent);
    actionBar.setLogo(R.drawable.up_icon);
    actionBar.setTitle(R.string.observation_photos);

    mApp = (INaturalistApp) getApplicationContext();
    setContentView(R.layout.observation_photos);

    Intent intent = getIntent();

    try {
      if (savedInstanceState == null) {
        String observationString = intent.getStringExtra("observation");
        if (observationString != null) mObservation = new JSONObject(observationString);
      } else {
        mObservation = new JSONObject(savedInstanceState.getString("observation"));
      }
    } catch (JSONException e) {
      e.printStackTrace();
    }

    mViewPager = (HackyViewPager) findViewById(R.id.id_pic_view_pager);
    if (mObservation != null) {
      mViewPager.setAdapter(new IdPicsPagerAdapter(mObservation));
    }
  }
Exemplo n.º 6
0
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   final ActionBar actionBar = getSherlockActivity().getSupportActionBar();
   actionBar.setTitle("Nested fragment");
   actionBar.setSubtitle(String.valueOf(mTimestamp));
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle myextras = getIntent().getExtras();
    contextualGDS = (GruppoDiStudio) myextras.getSerializable(Constants.GDS_SUBS);

    // questo carica la materia nel gruppo
    new GetRelatedCorsoAS(GDS_members_activity.this, contextualGDS).execute();

    setContentView(R.layout.gds_members_activity);
    // customize layout
    ActionBar actionbar = getSupportActionBar();
    actionbar.setTitle(getResources().getString(R.string.gds_show_users));
    actionbar.setLogo(R.drawable.gruppistudio_icon_white);
    actionbar.setHomeButtonEnabled(true);
    actionbar.setDisplayHomeAsUpEnabled(true);

    // retrieving graphics from activity_layout
    TextView nome_gds = (TextView) findViewById(R.id.tv_nome_gds_detail_members);
    TextView materia_gds = (TextView) findViewById(R.id.tv_materia_gds_detail_members);
    ListView participants_gds = (ListView) findViewById(R.id.lv_partecipanti_gds_members);

    nome_gds.setText(contextualGDS.getNome());
    materia_gds.setText(contextualGDS.getMateria());

    if (contextualGDS.getStudentiGruppo() != null && !contextualGDS.getStudentiGruppo().isEmpty()) {
      Students_to_listview_adapter adapter =
          new Students_to_listview_adapter(
              GDS_members_activity.this,
              R.id.lv_partecipanti_gds_members,
              ((ArrayList<Studente>) contextualGDS.getStudentiGruppo()));
      participants_gds.setAdapter(adapter);
    }
  }
Exemplo n.º 8
0
 public void initActionBar() {
   mActionBar = getSupportActionBar();
   mActionBar.setDisplayHomeAsUpEnabled(true);
   mActionBar.setDisplayShowTitleEnabled(true);
   mActionBar.setTitle(stockName);
   mActionBar.setSubtitle(stockCode);
 }
Exemplo n.º 9
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_script);
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    currentFragmentPosition = FRAGMENT_SCRIPTS;

    if (savedInstanceState == null) {
      Bundle bundle = this.getIntent().getExtras();

      if (bundle != null) {
        currentFragmentPosition = bundle.getInt(EXTRA_FRAGMENT_POSITION, FRAGMENT_SCRIPTS);
      }
    }

    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    updateCurrentFragment(currentFragmentPosition, fragmentTransaction);
    fragmentTransaction.commit();

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    String currentSprite = ProjectManager.getInstance().getCurrentSprite().getName();
    actionBar.setTitle(currentSprite);

    buttonAdd = (ImageButton) findViewById(R.id.button_add);
    updateHandleAddButtonClickListener();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.year_browser);
    // set the home button in actionbar
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setTitle("Courses by Year");

    ActionBar.Tab year1Tab = actionBar.newTab().setText("Year 1");
    ActionBar.Tab year2Tab = actionBar.newTab().setText("Year 2");
    ActionBar.Tab year3Tab = actionBar.newTab().setText("Year 3");
    ActionBar.Tab year4Tab = actionBar.newTab().setText("Year 4");
    ActionBar.Tab year5Tab = actionBar.newTab().setText("Year 5");

    Fragment year1Frag = new Year1Fragment();
    Fragment year2Frag = new Year2Fragment();
    Fragment year3Frag = new Year3Fragment();
    Fragment year4Frag = new Year4Fragment();
    Fragment year5Frag = new Year5Fragment();

    year1Tab.setTabListener(new YearTabsListener(year1Frag));
    year2Tab.setTabListener(new YearTabsListener(year2Frag));
    year3Tab.setTabListener(new YearTabsListener(year3Frag));
    year4Tab.setTabListener(new YearTabsListener(year4Frag));
    year5Tab.setTabListener(new YearTabsListener(year5Frag));

    actionBar.addTab(year1Tab);
    actionBar.addTab(year2Tab);
    actionBar.addTab(year3Tab);
    actionBar.addTab(year4Tab);
    actionBar.addTab(year5Tab);
  }
Exemplo n.º 11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setTheme(Gh4Application.THEME);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.generic_list);

    mRepoOwner = getIntent().getExtras().getString(Constants.Repository.REPO_OWNER);
    mRepoName = getIntent().getExtras().getString(Constants.Repository.REPO_NAME);
    mFilePath = getIntent().getExtras().getString(Constants.Object.PATH);
    mRef = getIntent().getExtras().getString(Constants.Object.REF);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle("History");
    actionBar.setSubtitle(mFilePath);

    ListView listView = (ListView) findViewById(R.id.list_view);
    listView.setOnItemClickListener(this);

    mCommitAdapter = new CommitAdapter(this, new ArrayList<RepositoryCommit>());
    listView.setAdapter(mCommitAdapter);

    loadData();

    getSupportLoaderManager().initLoader(0, null, this);
    getSupportLoaderManager().getLoader(0).forceLoad();
  }
 private void setupActionBar() {
   final ActionBar actionbar = getSherlockActivity().getSupportActionBar();
   actionbar.setDisplayOptions(
       ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
   actionbar.setTitle(getArguments().getString("courseName"));
   actionbar.setSubtitle(getArguments().getString("itemName"));
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.data_layout);

    d_pb_ll = (LinearLayout) findViewById(R.id.data_progressbar_ll);
    dataUsedText = (TextView) findViewById(R.id.dataUsedText);
    mProgress = (ProgressBar) findViewById(R.id.percentDataUsed);
    dell = (LinearLayout) findViewById(R.id.data_error);
    detv = (TextView) findViewById(R.id.tv_failure);
    deb = (Button) findViewById(R.id.button_send_data);
    actionbar = getSupportActionBar();
    actionbar.setTitle("Data Usage");
    actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionbar.setHomeButtonEnabled(true);
    actionbar.setDisplayHomeAsUpEnabled(true);

    graph = (XYPlot) findViewById(R.id.mySimpleXYPlot);
    graph.setOnTouchListener(this);
    graph.setMarkupEnabled(false);

    labels = new Long[288];
    downdata = new Float[288];
    totaldata = new Float[288];

    httpclient = ConnectionHelper.getThreadSafeClient();
    httpclient.getCookieStore().clear();
    BasicClientCookie cookie =
        new BasicClientCookie("AUTHCOOKIE", ConnectionHelper.getPNAAuthCookie(this, httpclient));
    cookie.setDomain(".pna.utexas.edu");
    httpclient.getCookieStore().addCookie(cookie);
    new fetchDataTask(httpclient).execute();
    new fetchProgressTask(httpclient).execute();
  }
Exemplo n.º 14
0
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   final ActionBar actionBar = getSherlockActivity().getSupportActionBar();
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setTitle("Session 4");
   actionBar.setSubtitle("nested fragment");
 }
 private void setActionBar() {
   String currentName = Util.getPickedAccountName(this);
   if (currentName != null) {
     ActionBar bar = getSupportActionBar();
     if (bar != null && currentName != null) {
       bar.setTitle(currentName);
     }
   }
 }
Exemplo n.º 16
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Log.d(TAG, "onCreate");

    // Get the actionbar
    mActionBar = getSherlockActivity().getSupportActionBar();
    mActionBar.setTitle(R.string.player_playlist);
    setHasOptionsMenu(true);
  }
Exemplo n.º 17
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.create_layout);
    // ActionBar gets initiated
    actionBar = getSupportActionBar();
    actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("Compose");
    myDataBase = new TaskDataBaseSQL(this);

    drawer = new SlidingMenu(this);
    drawer.setMode(SlidingMenu.LEFT);
    drawer.setShadowDrawable(R.drawable.shadow);
    drawer.setShadowWidthRes(R.dimen.shadow_width);
    drawer.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    drawer.setFadeDegree(0.35f);
    drawer.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    drawer.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    drawer.offsetTopAndBottom(25);
    drawer.setMenu(R.layout.alarmslidingmenu);
    drawer.setSlidingEnabled(false);
    positionOftaskToEdit = -1;
    initilizeViewVariables();
    coder = new Geocoder(this);
    myGPSManager = new TaskGPSManager(this);
    myalarmmanager = new MyAlarmManager(this);
    timepicker.setCurrentHour(myalarmmanager.getHourOfDay());

    if (getIntent().hasExtra("ob")) {
      positionOftaskToEdit = getIntent().getIntExtra("ob", 0);
      taskBeforeEdit = TaskList.getTasksList().get(positionOftaskToEdit);
      initilizeViewForExistingTask();
      actionBar.setTitle("Edit");
      Log.d(getClass().getSimpleName(), "Editing A Task" + "id: " + taskBeforeEdit.getTaskId());
    } else {
      initilizeForNewTask();
      Log.d(getClass().getSimpleName(), "Creating New Task");
    }
  }
Exemplo n.º 18
0
  @Override
  protected void onCreate(Bundle arg0) {
    // TODO Auto-generated method stub
    super.onCreate(arg0);
    setContentView(R.layout.route);

    mHandler = new RouteHandler(this);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getString(R.string.route));
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
  }
Exemplo n.º 19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.show_info);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getString(R.string.context_showinfo));
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    fillData();
  }
Exemplo n.º 20
0
  // Called on when activity is first started
  @Override
  public void onCreate(Bundle b) {
    super.onCreate(b);
    // Setup the Progress Spinner in the AB
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Setup the Action Bar
    ActionBar ab = getSupportActionBar();
    ab.setTitle(R.string.ab_title_view_car);
    ab.setDisplayHomeAsUpEnabled(true);

    // Set the view. The fragment is loaded in XML and takes care of starting the loader
    setContentView(R.layout.car_list_layout);
  }
Exemplo n.º 21
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    mFirstRun = savedInstanceState == null;
    // This line restore instance state when we are change theme and
    // activity restarts
    savedInstanceState = instanceState(savedInstanceState);
    super.onCreate(savedInstanceState);

    mCreatedByThemeManager =
        getIntent().getBooleanExtra(ThemeManager.KEY_CREATED_BY_THEME_MANAGER, false);
    if (mCreatedByThemeManager) {
      mFirstRun = false;
    }

    if (savedInstanceState != null) {
      mDisableMusic = savedInstanceState.getBoolean(KEY_DISABLE_MUSIC, false);
      mCurrentPage = savedInstanceState.getInt(KEY_PAGE, 0);
    }

    final ActionBar ab = getSupportActionBar();
    ab.setTitle(R.string.library_name);

    setContentView(R.layout.content);

    final SlidingMenuA addonSM = requireSlidingMenu();
    final SlidingMenu sm = addonSM.getSlidingMenu();

    View menu = findViewById(R.id.menu);
    if (menu == null) {
      // Phone
      mStaticSlidingMenu = true;
      ab.setDisplayHomeAsUpEnabled(true);
      addonSM.setBehindContentView(makeMenuView(savedInstanceState));
      addonSM.setSlidingActionBarEnabled(true);
      sm.setBehindWidth(computeMenuWidth());
      sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
      sm.setSlidingEnabled(true);
    } else {
      // Tablet
      mStaticSlidingMenu = false;
      addonSM.setBehindContentView(new View(this)); // dummy view
      sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
      sm.setSlidingEnabled(false);
      prepareMenuView(menu, savedInstanceState);
    }

    getSupportFragmentManager().addOnBackStackChangedListener(this);
  }
Exemplo n.º 22
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    fixImageTilingOn(getSupportActionBar());
    repositoryScope.doWith(
        repo(),
        new Runnable() {
          public void run() {
            setContentView(R.layout.tag_viewer_activity);
          }
        });

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(tagName);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
Exemplo n.º 23
0
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Action bar Sherlock
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setTitle("Preferences");

    try {
      getClass().getMethod("getFragmentManager");
      AddResourceApi11AndGreater();
    } catch (NoSuchMethodException e) { // Api < 11
      AddResourceApiLessThan11();
    }
  }
Exemplo n.º 24
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setTheme(Gh4Application.THEME);
    super.onCreate(savedInstanceState);

    fileStacks = new ArrayList<ContentListFragment>();
    mContentList = new ArrayList<List<Content>>();

    Bundle data = getIntent().getExtras().getBundle(Constants.DATA_BUNDLE);
    if (data != null) {
      mRepoOwner = data.getString(Constants.Repository.REPO_OWNER);
      mRepoName = data.getString(Constants.Repository.REPO_NAME);
    } else {
      Bundle bundle = getIntent().getExtras();
      mRepoOwner = bundle.getString(Constants.Repository.REPO_OWNER);
      mRepoName = bundle.getString(Constants.Repository.REPO_NAME);
      mSelectedRef = bundle.getString(Constants.Repository.SELECTED_REF);
      mSelectBranchTag = bundle.getString(Constants.Repository.SELECTED_BRANCHTAG_NAME);
    }

    if (!isOnline()) {
      setErrorView();
      return;
    }

    setContentView(R.layout.view_pager_repo);

    mActionBar = getSupportActionBar();
    mActionBar.setTitle(mRepoOwner + "/" + mRepoName);
    mActionBar.setDisplayHomeAsUpEnabled(true);

    showLoading();
    getSupportLoaderManager().initLoader(0, null, this);
    getSupportLoaderManager().getLoader(0).forceLoad();

    getSupportLoaderManager().initLoader(1, null, this);
    getSupportLoaderManager().initLoader(2, null, this);

    getSupportLoaderManager().initLoader(3, null, this);
    getSupportLoaderManager().getLoader(3).forceLoad();

    getSupportLoaderManager().initLoader(4, null, this);
  }
Exemplo n.º 25
0
 /** 主界面初始化 */
 public void initContentview() {
   // actionbar
   ActionBar supportActionBar = getSupportActionBar();
   supportActionBar.setIcon(R.drawable.ic_duobei);
   supportActionBar.setTitle("多贝公开课");
   // menudrawer
   mDrawer = MenuDrawer.attach(this, Type.OVERLAY);
   mDrawer.setContentView(R.layout.activity_main);
   // 初始化3个tab
   fm = getSupportFragmentManager();
   FragmentTransaction ft = fm.beginTransaction();
   mhomeFragment = new HomeFragment();
   mhomeFragment.addpager("新课速递", new NewCourseFragment());
   mhomeFragment.addpager("每日推荐", new DailyRecFragment());
   mhomeFragment.addpager("精选课程", new PickCourseFragment());
   ft.add(R.id.container, mhomeFragment);
   ft.addToBackStack(null);
   ft.commit();
 }
Exemplo n.º 26
0
  /*
   * inicializa
   * (non-Javadoc)
   * @see android.app.Activity#onCreate(android.os.Bundle)
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub

    super.onCreate(savedInstanceState);
    setContentView(R.layout.resultadostest);
    ActionBar bar = getSupportActionBar();
    bar.setTitle("Recomendaciones");
    bar.setIcon(R.drawable.home_icon_normal_invert);
    bar.setHomeButtonEnabled(true);

    if (savedInstanceState == null) {

      Recomendaciones.getResultados(this);

    } else {

      getContents(savedInstanceState.getString("json"));
    }
  }
Exemplo n.º 27
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ActionBar actionbar = getSupportActionBar();
    actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionbar.setTitle("PROFILE");
    Tab frag1tab = actionbar.newTab().setText("LOGIN");
    Tab frag2tab = actionbar.newTab().setText("REGISTER");

    Fragment fragment1 = new LoginFragment();
    Fragment fragment2 = new RegistrationFragment();

    frag1tab.setTabListener(new MyTabListener(fragment1));
    frag2tab.setTabListener(new MyTabListener(fragment2));

    actionbar.addTab(frag1tab);
    actionbar.addTab(frag2tab);
  }
Exemplo n.º 28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main_loginfb);

    Button btnLogin = (Button) findViewById(R.id.btnLoginFb);
    mFacebook = new Facebook(APP_ID);

    context = LoginFb.this;
    manager = new SessionManager(context);

    btnLogin.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            boolean internet = new InternetUtil(LoginFb.this).isConnectingToInternet();
            if (internet) {
              AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(mFacebook);
              mFacebook.authorize(LoginFb.this, APP_PERMISIONS, new LoginDialogListener());
            } else {
              Toast.makeText(LoginFb.this, "Necesita Conectarse a Internet.", Toast.LENGTH_SHORT)
                  .show();
            }
          }
        });

    // nos salteamos el logueo
    if (manager.getEstadoSession()) {
      ((SherlockActivity) context).finish();
      context.startActivity(new Intent(context, Map.class));
      ((SherlockActivity) context).overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    }

    ActionBar ab = getSupportActionBar();
    ab.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
    ab.setTitle(getString(R.string.register_user));
  }
Exemplo n.º 29
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    setContentView(R.layout.routes_list);

    // Set up the Action Bar
    ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(R.string.routes);

    getExpandableListView()
        .setOnChildClickListener(
            new OnChildClickListener() {
              public boolean onChildClick(
                  ExpandableListView parent,
                  View v,
                  int groupPosition,
                  int childPosition,
                  long id) {
                long destinationId = -1;

                Route route = routes.get(groupPosition);
                destinations = route.getDestinations();
                destinationId = destinations.get(childPosition).getId();

                Bundle bundle = new Bundle();
                bundle.putLong("destinationId", destinationId);
                Intent stopsListIntent =
                    new Intent(RoutesListActivity.this, StopsListActivity.class);
                stopsListIntent.putExtras(bundle);
                startActivityForResult(stopsListIntent, 1);
                return true;
              }
            });

    displayRoutes();
  }
Exemplo n.º 30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_course_detail);
    ActionBar bar = getSupportActionBar();
    bar.setBackgroundDrawable(getResources().getDrawable(R.drawable.gradient));
    bar.setDisplayHomeAsUpEnabled(true);
    bar.setTitle("Course Description");
    Bundle extras = getIntent().getExtras();
    i = getIntent().getExtras();
    final Course selected = List.mcourse.get(extras.getInt("SecID"));
    final ListView sections = (ListView) findViewById(R.id.sectionlist);
    CustomAdapter adapter;
    TextView Name = (TextView) findViewById(R.id.CName);
    TextView Prereqs = (TextView) findViewById(R.id.section_prereq_full);
    Prereqs.setMovementMethod(new ScrollingMovementMethod()); // Scrolling textfield
    Name.setText(selected.title);
    Section allSections[] = List.mcourse.get(extras.getInt("SecID")).sections;

    getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Adds back button functionality
    sections.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String credits = selected.credits;
            Section in = selected.sections[position];
            Popup(in, credits);
          }
        });

    if (selected.preReqNotes != null) {
      Prereqs.setText(
          selected.preReqNotes.replaceAll("\\<.*?>", "")); // Removes leftover html tagging
    } else {
      Prereqs.setText("None");
    }
    adapter = new CustomAdapter(this, R.layout.section_item, allSections);
    // adapter = new CustomAdapter(CourseDetail.this,R.id.sectionlist,allSections);
    sections.setAdapter(adapter);
  }