Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package samkough.com.thequotebook;
- import android.support.v7.app.ActionBarActivity;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.widget.RelativeLayout;
- import android.widget.TextView;
- import java.util.ArrayList;
- public class Quotebook extends ActionBarActivity
- {
- int count = 0;
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_quotebook);
- RelativeLayout touch = (RelativeLayout) findViewById(R.id.touch);
- final TextView quoteText = (TextView) findViewById(R.id.quote);
- final TextView personText = (TextView) findViewById(R.id.person);
- final ArrayList<Quote> quoteList = new ArrayList<Quote>();
- Quote quote4 = new Quote("You're more of a fun vampire. You don't suck blood, you just suck.", "Troy Barnes");
- quoteList.add(quote4);
- Quote quote1 = new Quote("Cool Beans", "Rod Kimble");
- quoteList.add(quote1);
- Quote quote2 = new Quote("How can mirrors be real if our eyes aren't real", "Jaden Smith");
- quoteList.add(quote2);
- Quote quote3 = new Quote("That's like me blaming owls for how bad I suck at analogies.", "Britta Perry");
- quoteList.add(quote3);
- Quote quote5 = new Quote("I was gonna be the first person in my family to graduate from community college. Everyone else graduated from normal college", "Troy Barnes");
- quoteList.add(quote5);
- touch.setOnClickListener(new View.OnClickListener()
- {
- @Override
- public void onClick(View view)
- {
- if (count < quoteList.size())
- {
- Quote q = quoteList.get(count);
- quoteText.setText(q.getQuote());
- personText.setText(q.getPerson());
- count = count + 1;
- }
- else
- {
- count = 0;
- }
- }
- });
- }
- /*public Quote quotes()
- {
- final ArrayList<Quote> quoteList = new ArrayList<Quote>();
- Quote quote4 = new Quote("You're more of a fun vampire. You don't suck blood, you just suck.", "Troy Barnes");
- quoteList.add(quote4);
- Quote quote1 = new Quote("Cool Beans", "Rod Kimble");
- quoteList.add(quote1);
- Quote quote2 = new Quote("How can mirrors be real if our eyes aren't real", "Jaden Smith");
- quoteList.add(quote2);
- Quote quote3 = new Quote("That's like me blaming owls for how bad I suck at analogies.", "Britta Perry");
- quoteList.add(quote3);
- Quote quote5 = new Quote("I was gonna be the first person in my family to graduate from community college. Everyone else graduated from normal college", "Troy Barnes");
- quoteList.add(quote5);
- }*/
- @Override
- public boolean onCreateOptionsMenu(Menu menu)
- {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_quotebook, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item)
- {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- //noinspection SimplifiableIfStatement
- if (id == R.id.action_settings)
- {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- }
- -------------------------------------------------------------------------------------------------------------------------------
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:id="@+id/touch">
- <TextView
- android:text="Tap the screen to inkfa"
- android:id="@+id/quote"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:fontFamily="sans-serif-medium"
- android:textSize="26sp"
- android:layout_gravity="center"
- android:layout_above="@+id/person"
- android:textColor="#ffff0000"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true" />
- <TextView
- android:text=""
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:fontFamily="sans-serif-medium"
- android:textSize="26sp"
- android:gravity="end"
- android:textColor="#ffff0000"
- android:layout_gravity="center"
- android:id="@+id/person"
- android:layout_alignParentBottom="true"
- android:layout_alignLeft="@+id/quote"
- android:layout_alignStart="@+id/quote" />
- </RelativeLayout>
- -------------------------------------------------------------------------------------------------------------------------------
- package samkough.com.thequotebook;
- /**
- * Created by Sammy on 4/27/2015.
- */
- public class Quote
- {
- public String quote;
- public String person;
- public Quote(String mQuote, String mPerson)
- {
- quote = mQuote;
- person = mPerson;
- }
- public String getPerson()
- {
- return person;
- }
- public String getQuote()
- {
- return quote;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement