Skip to content

Commit

Permalink
Merge pull request #90 from XDagger/develop
Browse files Browse the repository at this point in the history
Develop: Fix bugs and update some icons.
  • Loading branch information
ssyijiu authored Jan 15, 2019
2 parents b61fc9a + 2f92907 commit d77251f
Show file tree
Hide file tree
Showing 59 changed files with 546 additions and 275 deletions.
7 changes: 2 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ static def buildTime() {

android {
compileSdkVersion compile_version
buildToolsVersion build_tools_version
defaultConfig {
applicationId "io.xdag.xdagwallet"
minSdkVersion min_version
targetSdkVersion target_version
versionCode 24
versionName "0.2.4"
versionCode 25
versionName "0.2.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
Expand Down Expand Up @@ -74,8 +73,6 @@ dependencies {
implementation 'com.tapadoo.android:alerter:2.0.5'
// https://github.com/yanzhenjie/AndPermission
implementation 'com.yanzhenjie:permission:2.0.0-rc6'
// https://github.com/aurelhubert/ahbottomnavigation
implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
// https://github.com/PureWriter/about-page
implementation 'me.drakeet.support:about:2.1.1'
implementation 'me.drakeet.multitype:multitype:3.4.4'
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.xdag.xdagwallet">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Expand All @@ -14,7 +15,8 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="android.max_aspect"
android:value="2.4"/>
Expand Down
66 changes: 29 additions & 37 deletions app/src/main/java/io/xdag/xdagwallet/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
import android.support.v4.app.FragmentManager;
import android.view.View;
import butterknife.BindView;
import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.Permission;
import io.xdag.common.Common;
import io.xdag.common.base.ToolbarActivity;
import io.xdag.common.tool.ActivityStack;
import io.xdag.common.tool.ToolbarMode;
Expand All @@ -23,6 +20,8 @@
import io.xdag.xdagwallet.fragment.SendFragment;
import io.xdag.xdagwallet.util.AlertUtil;
import io.xdag.xdagwallet.util.ToolbarUtil;
import io.xdag.xdagwallet.widget.BottomBar;
import io.xdag.xdagwallet.widget.BottomBarItem;
import io.xdag.xdagwallet.wrapper.XdagEvent;
import io.xdag.xdagwallet.wrapper.XdagEventManager;
import io.xdag.xdagwallet.wrapper.XdagHandlerWrapper;
Expand All @@ -39,9 +38,8 @@ public class MainActivity extends ToolbarActivity {

private static final String EXTRA_RESTORE = "extra_restore";
private static final String EXTRA_SWITCH_POOL = "extra_switch_pool";
public static boolean isStart = false;
@BindView(R.id.bottom_navigation)
AHBottomNavigation mNavigationView;
BottomBar mBottomBar;

private FragmentManager mFragmentManager;
private HomeFragment mHomeFragment;
Expand All @@ -56,7 +54,6 @@ public class MainActivity extends ToolbarActivity {

@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isStart = true;
ActivityStack.getInstance().finishNotTopActivities();
}

Expand All @@ -72,6 +69,7 @@ protected boolean enableEventBus() {
return true;
}


@Override
protected void initView(View rootView, Bundle savedInstanceState) {
mFragmentManager = getSupportFragmentManager();
Expand All @@ -80,7 +78,7 @@ protected void initView(View rootView, Bundle savedInstanceState) {
} else {
recoverFragment();
}
initNavigationView();
initBottomBar();
}


Expand Down Expand Up @@ -131,7 +129,7 @@ protected void onNewIntent(Intent intent) {
XdagHandlerWrapper.getInstance(this).disconnectPool();
mHomeFragment.showNotReady();
showFragment(mHomeFragment);
mNavigationView.setCurrentItem(mHomeFragment.getPosition());
mBottomBar.setCurrentItem(mHomeFragment.getPosition());
}
}

Expand All @@ -151,34 +149,23 @@ public void ProcessXdagEvent(XdagEvent event) {
}


private void initNavigationView() {
// create items
AHBottomNavigationItem home =
new AHBottomNavigationItem(getString(R.string.home), R.drawable.ic_home);
AHBottomNavigationItem receive =
new AHBottomNavigationItem(getString(R.string.receive), R.drawable.ic_receive);
AHBottomNavigationItem send =
new AHBottomNavigationItem(getString(R.string.send), R.drawable.ic_send);
AHBottomNavigationItem setting =
new AHBottomNavigationItem(getString(R.string.more), R.drawable.ic_more);
// add items
mNavigationView.addItem(home);
mNavigationView.addItem(receive);
mNavigationView.addItem(send);
mNavigationView.addItem(setting);
// the selectedImage item color
mNavigationView.setAccentColor(Common.getColor(R.color.colorPrimary));
// the unselected item color
mNavigationView.setInactiveColor(Common.getColor(R.color.GERY));
// set titles
mNavigationView.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
// set current item selectedImage
mNavigationView.setCurrentItem(0);
ToolbarUtil.setToolbar(0, getToolbar());
// set listeners
mNavigationView.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {
@Override
public boolean onTabSelected(int position, boolean wasSelected) {
private void initBottomBar() {

mBottomBar.addItem(
new BottomBarItem(mContext, R.mipmap.ic_home, R.mipmap.ic_home_unselected,
getString(R.string.home)));
mBottomBar.addItem(
new BottomBarItem(mContext, R.mipmap.ic_receive, R.mipmap.ic_receive_unselected,
getString(R.string.receive)));
mBottomBar.addItem(
new BottomBarItem(mContext, R.mipmap.ic_send, R.mipmap.ic_send_unselected,
getString(R.string.send)));
mBottomBar.addItem(
new BottomBarItem(mContext, R.mipmap.ic_more, R.mipmap.ic_more_unselected,
getString(R.string.setting)));

mBottomBar.setOnTabSelectedListener(new BottomBar.OnTabSelectedListener() {
@Override public void onTabSelected(int position, int prePosition) {
switch (position) {
case 0:
showFragment(mHomeFragment);
Expand All @@ -193,8 +180,13 @@ public boolean onTabSelected(int position, boolean wasSelected) {
showFragment(mSettingFragment);
break;
}
return true;
}


@Override public void onTabUnselected(int position) { }


@Override public void onTabReselected(int position) { }
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void onRefresh() {
private void requestTranDetail(final boolean alert) {

mDisposable.add(
HttpRequest.get().getBlockDetail(mContext, mAddress,
HttpRequest.get().getTransactionDetail(mContext, mAddress,
blockAsAddresses -> showTransaction(blockAsAddresses, alert))
);
}
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/java/io/xdag/xdagwallet/activity/UsageActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected void initView(View rootView, Bundle savedInstanceState) {
if (mCbRootRemind.isChecked()) {
Config.setNotRemindRoot(true);
}
if (isNotShow()) {
if (isNotDisplay()) {
WalletActivity.start(mContext);
finish();
}
Expand All @@ -99,7 +99,7 @@ protected void initView(View rootView, Bundle savedInstanceState) {
mContext.finish();
});
builder.show();
} else if (isNotShow()) {
} else if (isNotDisplay()) {
WalletActivity.start(mContext);
finish();
} else {
Expand All @@ -116,7 +116,7 @@ void explain_btn_start() {
return;
}
WalletActivity.start(mContext);
if (isNotShow()) {
if (isNotDisplay()) {
finish();
}
}
Expand All @@ -128,7 +128,7 @@ void explain_btn_pool() {
}


public static boolean isNotShow() {
public static boolean isNotDisplay() {
return Config.isUserBackup() && Config.isNotDisplayUsage();
}

Expand Down Expand Up @@ -163,8 +163,5 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@Override protected void onDestroy() {
RxUtil.dispose(mDisposable);
super.onDestroy();
if (!MainActivity.isStart) {
ActivityStack.getInstance().exit();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ public class WalletActivity extends ToolbarActivity {
@BindView(R.id.wallet_tv_function_text)
TextView mTvFunction;


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
}


@Override
protected int getLayoutResId() {
return R.layout.activity_wallet;
Expand Down Expand Up @@ -87,7 +79,6 @@ void wallet_btn_restore() {
.onGranted(data -> {
if (XdagHandlerWrapper.createSDCardFile(mContext) != null) {
RestoreActivity.start(mContext);
finish();
}
})
.start();
Expand All @@ -108,7 +99,7 @@ protected int getToolbarTitle() {

@Override
protected int getToolbarMode() {
if (UsageActivity.isNotShow()) {
if (UsageActivity.isNotDisplay()) {
return ToolbarMode.MODE_NONE;
}
return ToolbarMode.MODE_BACK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ protected void init() {
View view = View.inflate(getContext(), R.layout.layout_dialog_input, null);
setView(view);
mEtInput = view.findViewById(R.id.dialog_input_et);
setCancelable(false);
setPositiveButton(R.string.ensure, (dialog, which) -> {
if (mOnPositiveClickListener != null) {
mOnPositiveClickListener.onClick(dialog, mEtInput.getText().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protected void init() {
super.init();
View view = View.inflate(getContext(), R.layout.layout_dialog_loading, null);
setView(view);
setCancelable(false);
mTvMessage = view.findViewById(R.id.dialog_loading_tv);
}

Expand Down
7 changes: 0 additions & 7 deletions app/src/main/java/io/xdag/xdagwallet/dialog/TipBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;

import io.xdag.common.base.AlertBuilder;
import io.xdag.xdagwallet.R;

Expand All @@ -13,16 +12,10 @@
*/
public class TipBuilder extends AlertBuilder {


public TipBuilder(@NonNull Context context) {
super(context);
}

@Override
protected void init() {
super.init();
setCancelable(false);
}

public AlertDialog.Builder setPositiveListener(DialogInterface.OnClickListener listener) {
setPositiveButton(R.string.ensure, listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void requestUpdate() {

private void requestTransaction() {
mDisposable.add(HttpRequest.get()
.getBlockList(mContext, mTvAddress.getText().toString(), this::showTransaction));
.getTransactions(mContext, mTvAddress.getText().toString(), this::showTransaction));
}


Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/io/xdag/xdagwallet/net/ApiServer.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.xdag.xdagwallet.net;

import io.xdag.common.http.ApiFactory;
import io.xdag.xdagwallet.config.Config;
import io.xdag.xdagwallet.net.api.ConfigApi;
import io.xdag.xdagwallet.net.api.TransactionApi;

Expand All @@ -12,18 +13,18 @@
public class ApiServer {

public static final String BASE_URL_TRANSACTION = "https://explorer.xdag.io/api/block/";
public static final String BASE_URL_TRANSACTION2 = "http://139.99.124.100/api/block/";
private static final String BASE_URL_GITHUB = "https://raw.githubusercontent.com/";

private ApiServer() {
throw new UnsupportedOperationException("ApiServer cannot be instantiated !");
}

static TransactionApi getTransactionApi(String baseUrl) {
static TransactionApi createTransactionApi() {
String baseUrl = Config.getTransactionHost();
return ApiFactory.getInstance().createApi(baseUrl, TransactionApi.class);
}

static ConfigApi getConfigApi() {
static ConfigApi createConfigApi() {
return ApiFactory.getInstance().createApi(BASE_URL_GITHUB, ConfigApi.class);
}
}
Loading

0 comments on commit d77251f

Please sign in to comment.