Skip to content

Commit

Permalink
Adds custom titles for the SampleActivity and TwoToastersActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlton Whitehead committed Apr 30, 2013
1 parent f47f4c6 commit 4ef52f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions sample/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<item>@string/advanced_cluster_info_window_click_behavior_label</item>
</string-array>

<string name="sample_activity">Sample Activity - %1$s</string>
<string name="point_number_x">Point #%1$s</string>
<string name="including_two_toasters">%1$s (including Two Toasters)</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ protected void onCreate(Bundle savedInstanceState) {

setContentView(R.layout.activity_sample);

int titleFormatArg = 0;
Intent i = getIntent();
if (i != null) {
Object options = i.getSerializableExtra(EXTRA_OPTIONS);
if (options instanceof Options) {
this.options = (Options)options;
titleFormatArg = R.string.mode_advanced_label;
}
}
if (this.options == null) {
this.options = new Options();
titleFormatArg = R.string.mode_normal_label;
}
setTitle(getString(R.string.sample_activity, getString(titleFormatArg)));

RandomPointsProvider rpp = RandomPointsProvider.getInstance();
ArrayList<InputPoint> inputPoints = rpp.getPoints();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class TwoToastersActivity extends FragmentActivity implements OnClickList
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.two_toasters);
setContentView(R.layout.activity_two_toasters);
View url = findViewById(R.id.two_toasters_url);
url.setOnClickListener(this);
Expand Down

0 comments on commit 4ef52f6

Please sign in to comment.