Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
OdysseyProtocol committed Feb 15, 2018
0 parents commit 9d229b3
Show file tree
Hide file tree
Showing 393 changed files with 17,727 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
65 changes: 65 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.ocoin.demo"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true

}

packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
exclude 'META-INF/rxjava.properties'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}



repositories {
flatDir {
dirs 'libs', '../aars'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.1'

compile 'com.jaredrummler:android-processes:1.0.8'

compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'


//butterknife
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

compile project (':walletsdk')

}
Binary file added app/libs/httpclient-4.2.5.jar
Binary file not shown.
25 changes: 25 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/y/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ocoin.tempdemo;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

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

import static org.junit.Assert.*;

/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.snow.yp.demo.tempdemo", appContext.getPackageName());
}
}
27 changes: 27 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ocoin.tempdemo">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

<application
android:name="com.ocoin.demo.MyApp"
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="com.ocoin.demo.BankActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


</application>

</manifest>
98 changes: 98 additions & 0 deletions app/src/main/java/com/ocoin/demo/BankActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.ocoin.demo;

import android.content.BroadcastReceiver;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import butterknife.BindView;
import butterknife.ButterKnife;

import com.ocoin.WalletSDK;
import com.ocoin.activities.WalletMainActivity;
import com.ocoin.tempdemo.R;

import static com.ocoin.WalletSDK.getWalletAddress;

public class BankActivity extends AppCompatActivity {


@BindView(R.id.btn_generate_new_wallet)
Button btnGenerateNewWallet;
@BindView(R.id.btn_get_eth_coin)
Button btnGetEthCoin;
@BindView(R.id.btn_transaction_ocn)
Button btnTransactionOcn;
@BindView(R.id.btn_transaction_eth)
Button btnTransactionEth;

@BindView(R.id.btn_transaction_specify)
Button btnTransactionSpecify;

private BroadcastReceiver receiver = new MyTransactionStatusReceiver();


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
//generate wallet
btnGenerateNewWallet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WalletSDK.generateWallet(BankActivity.this);
}
});
//token list
btnGetEthCoin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WalletSDK.openOwnWallet(BankActivity.this);

}
});
//OCN TX
btnTransactionOcn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WalletSDK.sendTransaction(BankActivity.this, getWalletAddress(BankActivity.this), "0xd1bcbe82f40a9d7fbcbd28cca6043d72d66d8e9d");
}
});
//ETH TX
btnTransactionEth.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WalletSDK.sendTransaction(BankActivity.this, getWalletAddress(BankActivity.this), null);

}
});


final String testAddress = "0x14fef048b878132c4cdcf7819a66b1eaa9ce8fc2";
btnTransactionSpecify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WalletSDK.sendTransaction(BankActivity.this, getWalletAddress(BankActivity.this), testAddress, null, 2 + "");

}
});

IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("TX_ACTION");
this.registerReceiver(receiver, intentFilter);

}


@Override
protected void onDestroy() {
if (receiver != null)
this.unregisterReceiver(receiver);
super.onDestroy();
}


}
41 changes: 41 additions & 0 deletions app/src/main/java/com/ocoin/demo/MyApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.ocoin.demo;

import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;

import com.ocoin.WalletSDK;


/**
* Created by y on 2017/7/9.
*/

public class MyApp extends MultiDexApplication {

private static Context mContext;


@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);

}


@Override
public void onCreate() {
super.onCreate();
mContext = this;
WalletSDK.DEBUG(true);

WalletSDK.init(this);
}

public static Context getContext() {
return mContext;
}


}
28 changes: 28 additions & 0 deletions app/src/main/java/com/ocoin/demo/MyTransactionStatusReceiver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.ocoin.demo;

import com.ocoin.receiver.TransactionStatusReceiver;
import com.ocoin.utils.MyLog;

/**
* Created by y on 2018/2/9.
*/

public class MyTransactionStatusReceiver extends TransactionStatusReceiver {

@Override
public void onFail(String requestUUid, String txHash) {
MyLog.i("requestUUid:" + requestUUid + "txHash" + txHash);
}

@Override
public void onBuildSuccess(String requestUUid, String txHash) {
MyLog.i("requestUUid:" + requestUUid + "txHash" + txHash);

}

@Override
public void onTxSuccess(String requestUUid, String txHash) {
MyLog.i("requestUUid:" + requestUUid + "txHash" + txHash);

}
}
49 changes: 49 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="@color/primary_dark"
android:orientation="vertical"
tools:context="com.ocoin.demo.BankActivity">


<Button
android:id="@+id/btn_generate_new_wallet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/create_new_wallet"
android:textAllCaps="false" />

<Button
android:id="@+id/btn_get_eth_coin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/my_wallet"
android:textAllCaps="false" />


<Button
android:id="@+id/btn_transaction_ocn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OCN Transaction" />

<Button
android:id="@+id/btn_transaction_eth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

android:text="ETH Transaction"
android:textAllCaps="false" />


<Button
android:id="@+id/btn_transaction_specify"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fixed_trading"
android:textAllCaps="false" />


</LinearLayout>
Binary file added app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#587699</color>
<color name="colorPrimaryDark">#49627e</color>
<color name="colorAccent">#49627e</color>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>
<string name="app_name">OCoinWalletApp</string>
<string name="create_new_wallet">Create New Wallet</string>
<string name="my_wallet">My Wallet</string>
<string name="fixed_trading">Fixed trading</string>

<!-- TODO: Remove or change this placeholder text -->
</resources>
Loading

0 comments on commit 9d229b3

Please sign in to comment.