This file contains hidden or 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
package org.coursera.four; | |
import android.graphics.Bitmap; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.os.Bundle; | |
import android.support.v7.app.ActionBarActivity; | |
import android.text.Editable; | |
import android.text.TextWatcher; |
This file contains hidden or 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
public class MainActivity extends Activity { | |
// Delay in millisec. | |
private static final int DRAWER_DELAY = 200; | |
// Member varaible for navigation drawer. | |
private DrawerLayout mNavigationDrawerLayout; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
// Get the navigation drawer and assign to member variable. |
This file contains hidden or 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
/** | |
* When the user changes orientation in the activity, the activity is redrawn. | |
* To prevent loss of my variables (like what question is active) I save a variable into | |
* the instance state of my activity. | |
* When this is done, I can prevent the user fron detecting the redraw of my activity. | |
*/ | |
public class MainActivity extends Activity { | |
// My variable I want to keep. | |
public int currentQuestionNumber = 0; |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_validate(). | |
* | |
* Validation for configuration form. Since we need a number in the | |
* limit-textfield, we check that the input is correct. | |
* | |
* @url: https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_validate/7 | |
*/ |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_block_view(). | |
* | |
* Creates content for our block. It sets the title for the block, and returns | |
* our news (from our custom callback) as a ul-list, with the id 'espn-news'. | |
* | |
* @url: https://api.drupal.org/api/drupal/modules!block!block.api.php/function/hook_block_view/7 | |
*/ |
This file contains hidden or 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
<?php | |
/** | |
* Custom API content callback. | |
* | |
* This callback is a custom callback to get ESPN news data. | |
* Here we request the data, preprocesses it and creates a list of news. The | |
* array '$items' contains all the news, we'll display it as a unordered list | |
* later on. | |
* |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_form(). | |
* | |
* Creates a configuration form. See the API reference for info on different | |
* form inputs. | |
* | |
* From API Reference: https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7 | |
* |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_menu(). | |
* | |
* Defines paths to provide page callbacks and menu items for the site. | |
* Here it defines a configuration page with callback to a form, we'll | |
* create later on. | |
* | |
* @url: https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_menu/7 |
This file contains hidden or 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
name = ESPN News | |
description = Provides a block with recent ESPN sport news. | |
core = 7.x | |
package = Custom | |
; Link to configuration page, set in espn_news.module: espn_news_menu() | |
configure = admin/config/content/espn_news |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_block_view(). | |
* | |
* Creates content for our block. It sets the title for the block, and the | |
* content. | |
* | |
* @url: https://api.drupal.org/api/drupal/modules!block!block.api.php/function/hook_block_view/7 | |
*/ |
NewerOlder