Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
language: android
jdk: oraclejdk8

env:
global:
- ANDROID_TARGET=android-22
- ANDROID_ABI=armeabi-v7a

android:
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
- tools
- platform-tools

# The BuildTools version used by your project
- build-tools-23.0.3

# The SDK version used to compile your project
# TODO: why is this here explicitly in addition to $ANDROID_TARGET below
- android-23

# Additional components
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository

# The SDK version used to compile your project
- $ANDROID_TARGET

# Specify at least one system image,
# if you need to run emulator(s) during your tests.
# The line should look like this after interpolation:
# - sys-img-armeabi-v7a-android-22
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}

licenses:
- 'android-sdk-license-.+'

before_install:
# Accept sdk licenses
- yes | sdkmanager "platforms;android-29"

# Get gradle
- chmod +x gradlew
- wget http://services.gradle.org/distributions/gradle-5.3-bin.zip
- unzip -qq gradle-5.3-bin.zip
- export GRADLE_HOME=$PWD/gradle-5.3
- export PATH=$GRADLE_HOME/bin:$PATH

# Build the project
- gradle -v

# Start the emulator
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &

# The app will now automatically be installed and tested via
# the command `gradle connectedCheck`
63 changes: 34 additions & 29 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.simpleparadox.listycity"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.simpleparadox.listycity"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
package com.example.simpleparadox.listycity;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertEquals("com.example.simpleparadox.listycity", appContext.getPackageName());
}
}
package com.example.simpleparadox.listycity;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;


import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertEquals("com.example.simpleparadox.listycity", appContext.getPackageName());
}
}
43 changes: 24 additions & 19 deletions app/src/main/java/com/example/simpleparadox/listycity/City.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
package com.example.simpleparadox.listycity;

public class City {
private String city;
private String province;

City(String city, String province){
this.city = city;
this.province = province;
}

String getCityName(){
return this.city;
}

String getProvinceName(){
return this.province;
}
}
package com.example.simpleparadox.listycity;

public class City implements Comparable<City>{
private String city;
private String province;

City(String city, String province){
this.city = city;
this.province = province;
}

String getCityName(){
return this.city;
}

String getProvinceName(){
return this.province;
}

@Override
public int compareTo(City o) {
return city.compareTo(o.getCityName());
}
}
Loading