Skip to content
Permalink
Browse files
week 2 lab1
  • Loading branch information
Jianhua Yang committed Oct 9, 2017
1 parent 2d7c16e commit 0dc6b535226c899caad0f63211e2f9ef2622e1f8
Show file tree
Hide file tree
Showing 83 changed files with 133 additions and 784 deletions.

Some generated files are not rendered by default. Learn more.

@@ -300,7 +300,7 @@ Android studio has built-in version control system (VCS) support. In fact, there

2. Go back to Android Studio, click VCS ==> Enable Version Control Integration..., and select Git as the tool. Now the 'Version Control' tool window will turn from pale to bright colors.

3. Locate your project title in the left-most position in the navigation bar, right-click on it and select Git ==> Add to add all files in your current project under control o Git. If you look at the 'Local Changes' tab in the 'Version Control' tool window, your 'Unversioned Files' will disappear and all files are under 'Default'.
3. Locate your project title in the left-most position in the navigation bar, right-click on it and select Git ==> Add to add all files in your current project under control of Git. If you look at the 'Local Changes' tab in the 'Version Control' tool window, your 'Unversioned Files' will disappear and all files are under 'Default'.

![vcs_default](.md_images/vcs_default.png)

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.jianhuayang.myvehicle"
minSdkVersion 15
targetSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -24,6 +24,7 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
@@ -15,3 +15,11 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.jianhuayang.mycar">
package="com.example.jianhuayang.myvehicle">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
</manifest>
@@ -1,7 +1,7 @@
package com.example.jianhuayang.myvehicle;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
@@ -26,7 +26,7 @@ public class MainActivity extends AppCompatActivity {
String strYear = editTextYear.getText().toString();

Vehicle vehicle;
if (strYear.equals("")) {
if (strYear.matches("")) {
vehicle = new Vehicle(make);
} else {
int intYear = Integer.parseInt(strYear);
@@ -36,4 +36,7 @@ public class MainActivity extends AppCompatActivity {
Log.d(TAG, "User clicked " + Vehicle.counter + " times.");
Log.d(TAG, "User message is \"" + vehicle + "\".");
}



}
@@ -1,12 +1,11 @@
package com.example.jianhuayang.myvehicle;

/**
* Created by jianhuayang on 08/10/2016.
* @author jianhuayang
* @version 1.1
* Created by jianhuayang on 09/10/2017.
*/

public class Vehicle {

public static int counter = 0;
private String make;
private int year;
@@ -20,18 +19,18 @@ public class Vehicle {
}

/*
* This constructor takes two parameters
* */
* This constructor takes two parameters.
*/
public Vehicle(String make, int year) {
this.make = make;
this.year = year;
this.message = "Your car is a " + make + " built in " + year + ".";
count();

}

/**
* The constructor that takes only the make of the car
* @param make the make of the car
* @param make the make of your car
*/
public Vehicle(String make) {
this();
@@ -49,7 +48,11 @@ public class Vehicle {
return message;
}

private void count(){
private void count() {
this.counter++;
}


}


@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context="com.example.jianhuayang.myvehicle.MainActivity">

<TextView
@@ -16,7 +17,7 @@
android:layout_height="wrap_content"
android:text="Type and Run"
android:textColor="@android:color/darker_gray"
android:textSize="24sp" />
android:textSize="24sp"/>

<TextView
android:id="@+id/labelMake"
@@ -28,7 +29,7 @@
android:layout_marginLeft="19dp"
android:layout_marginTop="56dp"
android:text="Make:"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:textAppearance="?android:attr/textAppearanceSmall"/>

<EditText
android:id="@+id/inputMake"
@@ -41,7 +42,7 @@
android:layout_toRightOf="@+id/labelMake"
android:ems="10"
android:hint="e.g. BMW"
android:inputType="textPersonName" />
android:inputType="textPersonName"/>

<TextView
android:id="@+id/lableYear"
@@ -52,7 +53,7 @@
android:layout_below="@id/labelMake"
android:layout_marginTop="20dp"
android:text="Year:"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:textAppearance="?android:attr/textAppearanceSmall"/>

<EditText
android:id="@+id/inputYear"
@@ -64,7 +65,7 @@
android:layout_alignStart="@+id/inputMake"
android:ems="10"
android:hint="e.g. 1980"
android:inputType="number" />
android:inputType="number"/>

<Button
android:id="@+id/button"
@@ -74,5 +75,7 @@
android:layout_centerHorizontal="true"
android:layout_marginTop="22dp"
android:onClick="onButtonClick"
android:text="Run" />
android:text="Run"/>
</RelativeLayout>


Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.3.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Sun Oct 08 23:53:34 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
File renamed without changes.

0 comments on commit 0dc6b53

Please sign in to comment.