-
Notifications
You must be signed in to change notification settings - Fork 10
[WIP] Japan example app #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gigiyy
wants to merge
17
commits into
develop
Choose a base branch
from
gz/japan_example_app
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
56f7f02
bump compile sdk version to 28
gigiyy cdc6247
new module for Japan example app
gigiyy 76500e5
order input screen
gigiyy 79fcb33
change imports for SmallTest
gigiyy 243c209
add event listeners for price, quantity and price type chages
gigiyy 756ec02
fix element size while switched to market price
gigiyy 8412a85
clean up code according to reviews by Feras
gigiyy f27283a
use view model to drive the market limit order button instead
gigiyy 45765f2
use view model factory to create the OrderInputViewModel
gigiyy cb20ffd
use EditText to input the price/quantity
gigiyy 5ac6be9
add resource files from Yahoo Japan
gigiyy ab93f6a
user can set order expiry
gigiyy ae9b3b4
user can pick account type
gigiyy f96f29a
user can pick a date for expiry
gigiyy ea2b985
apply material design to price/quantity selector
gigiyy 820cff2
show error message below the edittext using the layout
gigiyy c8ed8d6
show smaller error message
gigiyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
apply plugin: 'kotlin-android' | ||
|
||
apply plugin: 'kotlin-android-extensions' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "it.trade.android.japanapp" | ||
minSdkVersion 19 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
sourceSets { | ||
main.java.srcDirs += "src/main/kotlin" | ||
test.java.srcDirs += "src/test/kotlin" | ||
androidTest.java.srcDirs += "src/androidTest/kotlin" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
implementation 'com.android.support:appcompat-v7:28.0.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
implementation 'android.arch.lifecycle:extensions:1.1.1' | ||
implementation 'com.android.support:design:28.0.0' | ||
implementation project(':tradeit-android-sdk') | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-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 |
24 changes: 24 additions & 0 deletions
24
exampleAppJapan/src/androidTest/kotlin/it/trade/android/japanapp/ExampleInstrumentedTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package it.trade.android.japanapp | ||
|
||
import android.support.test.InstrumentationRegistry | ||
import android.support.test.runner.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getTargetContext() | ||
assertEquals("it.trade.android.japanapp", appContext.packageName) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="it.trade.android.japanapp"> | ||
|
||
<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" | ||
android:theme="@style/AppTheme"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
23 changes: 23 additions & 0 deletions
23
exampleAppJapan/src/main/kotlin/it/trade/android/japanapp/MainActivity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package it.trade.android.japanapp | ||
|
||
import android.support.v7.app.AppCompatActivity | ||
import android.os.Bundle | ||
import it.trade.android.japanapp.R | ||
import it.trade.android.japanapp.ui.orderinput.OrderInputFragment | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.main_activity) | ||
if (savedInstanceState == null) { | ||
supportFragmentManager.beginTransaction() | ||
// TODO this symbol is only for testing. and it's chosen as different to | ||
// the 8703 in Fragment class, so to distinguish how Fragment is initialized. | ||
// actual value should be provided by symbol lookup Fragment(not yet created.) | ||
.replace(R.id.container, OrderInputFragment.newInstance("8704")) | ||
.commitNow() | ||
} | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...pleAppJapan/src/main/kotlin/it/trade/android/japanapp/ui/orderinput/DatePickerFragment.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package it.trade.android.japanapp.ui.orderinput | ||
|
||
import android.app.DatePickerDialog | ||
import android.app.Dialog | ||
import android.os.Bundle | ||
import android.support.v4.app.DialogFragment | ||
import android.util.Log | ||
import android.widget.DatePicker | ||
import java.util.* | ||
|
||
class DatePickerFragment : DialogFragment(), DatePickerDialog.OnDateSetListener { | ||
|
||
private lateinit var cb: (String) -> Unit | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
val c = Calendar.getInstance() | ||
val year = c.get(Calendar.YEAR) | ||
val month = c.get(Calendar.MONTH) | ||
val day = c.get(Calendar.DAY_OF_MONTH) | ||
return DatePickerDialog(activity!!, this, year, month, day) | ||
} | ||
|
||
fun setDateSetPickerCallBack(cb: (String) -> Unit) { | ||
this.cb = cb | ||
} | ||
|
||
override fun onDateSet(view: DatePicker?, year: Int, month: Int, dayOfMonth: Int) { | ||
Log.d("OrderInputDatePicker", "picked a date: $year - ${month + 1} - $dayOfMonth") | ||
cb(String.format("%d%02d%02d", year, month + 1, dayOfMonth)) | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.