-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a032da
commit b77ef9e
Showing
50 changed files
with
3,765 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.onekey.tabpage"> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> | ||
</manifest> |
Binary file not shown.
Binary file not shown.
27 changes: 0 additions & 27 deletions
27
android/src/main/java/com/onekey/tabpage/SelectedLabelPackage.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
android/src/main/java/so/onekey/app/wallet/TabViewPackage.kt
This file contains 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,19 @@ | ||
package so.onekey.app.wallet | ||
|
||
import com.facebook.react.uimanager.ViewManager | ||
import com.facebook.react.ReactPackage | ||
import com.facebook.react.bridge.NativeModule | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import so.onekey.app.wallet.viewManager.homePage.HomePageManager | ||
import so.onekey.app.wallet.selectedLabel.SelectedLabelViewManager | ||
|
||
class TabViewPackage : ReactPackage { | ||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> = | ||
emptyList() | ||
|
||
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> = | ||
listOf( | ||
HomePageManager(), | ||
SelectedLabelViewManager() | ||
) | ||
} |
15 changes: 15 additions & 0 deletions
15
android/src/main/java/so/onekey/app/wallet/extensions/ReadableMapExt.kt
This file contains 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,15 @@ | ||
package so.onekey.app.wallet.extensions | ||
|
||
import com.facebook.react.bridge.ReadableMap | ||
|
||
fun ReadableMap.getIntOrNull(key: String): Int? { | ||
return if (hasKey(key)) getInt(key) else null | ||
} | ||
|
||
fun ReadableMap.getStringOrNull(key: String): String? { | ||
return if (hasKey(key)) getString(key) else null | ||
} | ||
|
||
fun ReadableMap.getBooleanOrNull(key: String): Boolean? { | ||
return if (hasKey(key)) getBoolean(key) else null | ||
} |
30 changes: 30 additions & 0 deletions
30
android/src/main/java/so/onekey/app/wallet/extensions/ViewExt.kt
This file contains 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,30 @@ | ||
package so.onekey.app.wallet.extensions | ||
|
||
import androidx.annotation.ColorInt | ||
import androidx.core.content.ContextCompat | ||
import so.onekey.app.wallet.utils.Utils | ||
|
||
private fun getApp() = Utils.getApp() | ||
private fun getTopActivity() = Utils.getTopActivity() | ||
|
||
fun Int.string(): String { | ||
// 国际化方案问题,MyApplication Context 没有改变 Locale。 | ||
return getTopActivity()?.getString(this) ?: getApp().getString(this) | ||
} | ||
|
||
@ColorInt | ||
fun String.color(): Int? { | ||
return try { | ||
(getTopActivity()?.resources ?: getApp().resources) | ||
.getIdentifier( | ||
this, "color", getApp().packageName | ||
).color() | ||
} catch (e: Exception) { | ||
null | ||
} | ||
} | ||
|
||
@ColorInt | ||
fun Int.color(): Int { | ||
return ContextCompat.getColor(getApp(), this) | ||
} |
2 changes: 1 addition & 1 deletion
2
...ava/com/onekey/tabpage/SelectedLabel.java → ...p/wallet/selectedLabel/SelectedLabel.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...key/tabpage/SelectedLabelViewManager.java → ...lectedLabel/SelectedLabelViewManager.java
This file contains 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
93 changes: 93 additions & 0 deletions
93
android/src/main/java/so/onekey/app/wallet/utils/HexUtils.java
This file contains 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,93 @@ | ||
package so.onekey.app.wallet.utils; | ||
|
||
import java.math.BigInteger; | ||
import java.util.Collections; | ||
|
||
/** | ||
* @author liyan | ||
*/ | ||
public class HexUtils { | ||
|
||
public static byte[] hexString2Bytes(String hex) { | ||
if (hex == null) return new byte[0]; | ||
return String2Bytes(hex, 16); | ||
} | ||
|
||
private static byte[] String2Bytes(String str, int digit) { | ||
byte[] bArray = new BigInteger("10" + str, digit).toByteArray(); | ||
|
||
byte[] ret = new byte[bArray.length - 1]; | ||
for (int i = 0; i < ret.length; i++) { | ||
ret[i] = bArray[i + 1]; | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
|
||
public static String stringToHexString(String s) { | ||
if (s == null) return ""; | ||
String str = ""; | ||
for (int i = 0; i < s.length(); i++) { | ||
int ch = s.charAt(i); | ||
String s4 = Integer.toHexString(ch); | ||
str = str + s4; | ||
} | ||
return str; | ||
} | ||
|
||
/** | ||
* 将字节数组转换成十六进制的字符串 | ||
* | ||
* @param bt 字节数组 | ||
* @param start 起始下标 | ||
* @param end 终止下标 | ||
*/ | ||
public static String byteArr2HexStr(byte[] bt, int start, int end) { | ||
return byteArr2HexStr(bt, start, end, ""); | ||
} | ||
|
||
/** | ||
* 将字节数组转换成十六进制的字符串 | ||
* | ||
* @param bt 字节数组 | ||
*/ | ||
public static String byteArr2HexStr(byte[] bt) { | ||
if (bt == null) return ""; | ||
if (bt.length == 0) return ""; | ||
return byteArr2HexStr(bt, 0, bt.length, ""); | ||
} | ||
|
||
/** | ||
* 将字节数组转换成十六进制的字符串 | ||
* | ||
* @param bt 字节数组 | ||
* @param start 起始下标 | ||
* @param end 终止下标 | ||
* @param sep 每个字节之间的分割字符串 | ||
*/ | ||
public static String byteArr2HexStr(byte[] bt, int start, int end, String sep) { | ||
if (bt == null || bt.length < end || start < 0 || start >= end) { | ||
throw new RuntimeException("param format error"); | ||
} | ||
|
||
StringBuffer sb = new StringBuffer(); | ||
for (int i = start; i < end; i++) { | ||
sb.append(byte2HexStr(bt[i])).append(sep); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* 将byte转换成对应的十六进制字符串(如:byte值0x3D转换成字符串"3D") | ||
* | ||
* @return 返回字符串长度一定为2 | ||
*/ | ||
public static String byte2HexStr(byte b) { | ||
int i = (b & 0xF0) >> 4; | ||
int j = (b & 0x0F); | ||
char c = (char) (i > 9 ? 'A' + i % 10 : '0' + i); | ||
char d = (char) (j > 9 ? 'A' + j % 10 : '0' + j); | ||
return "" + c + d; | ||
} | ||
} |
Oops, something went wrong.