Skip to content

Commit

Permalink
changing main view to example view
Browse files Browse the repository at this point in the history
  • Loading branch information
filipkis committed Jan 29, 2014
1 parent 7d9add3 commit 7d7243c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
13 changes: 6 additions & 7 deletions res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:id="@+id/main_view">

<TextView
android:id="@+id/example_text"
android:layout_width="wrap_content"
tools:context=".MainActivity">

<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
layout="@layout/example_view" />


</RelativeLayout>
14 changes: 14 additions & 0 deletions res/layout/example_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:id="@+id/example_view" >

<TextView
android:id="@+id/example_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

</RelativeLayout>
4 changes: 2 additions & 2 deletions src/se/kth/csc/iprog/dinnerplanner/android/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package se.kth.csc.iprog.dinnerplanner.android;

import se.kth.csc.iprog.dinnerplanner.android.view.MainView;
import se.kth.csc.iprog.dinnerplanner.android.view.ExampleView;
import se.kth.csc.iprog.dinnerplanner.model.DinnerModel;
import android.os.Bundle;
import android.app.Activity;
Expand All @@ -20,7 +20,7 @@ protected void onCreate(Bundle savedInstanceState) {
DinnerModel model = ((DinnerPlannerApplication) this.getApplication()).getModel();

// Creating the view class
MainView mainView = new MainView(findViewById(R.id.main_view), model);
ExampleView mainView = new ExampleView(findViewById(R.id.example_view), model);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import android.view.View;
import android.widget.TextView;

public class MainView {
public class ExampleView {

View view;

public MainView(View view, DinnerModel model) {
public ExampleView(View view, DinnerModel model) {

// store in the class the reference to the Android View
this.view = view;
Expand Down

0 comments on commit 7d7243c

Please sign in to comment.