Gas warnings (#1753)

Co-authored-by: jinkjonks <z5209175@ad.unsw.edu.au>
pull/1761/head
Jenny Jingjing Li 4 years ago committed by GitHub
parent 8d455a6f01
commit f5a152c7de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 131
      app/src/main/java/com/alphawallet/app/ui/GasSettingsActivity.java
  2. 38
      app/src/main/java/com/alphawallet/app/ui/widget/entity/GasWarningLayout.java
  3. 6
      app/src/main/java/com/alphawallet/app/ui/widget/entity/VisibilityCallback.java
  4. 20
      app/src/main/java/com/alphawallet/app/widget/AmountDisplayWidget.java
  5. 39
      app/src/main/java/com/alphawallet/app/widget/GasSliderView.java
  6. 86
      app/src/main/java/com/alphawallet/app/widget/GasWidget.java
  7. 8
      app/src/main/res/drawable/background_text_edit_error.xml
  8. 7
      app/src/main/res/drawable/background_warning_salmon.xml
  9. 166
      app/src/main/res/layout/activity_gas_settings.xml
  10. 1
      app/src/main/res/layout/dialog_action_sheet.xml
  11. 32
      app/src/main/res/layout/item_gas_settings.xml
  12. 2
      app/src/main/res/layout/item_gas_slider.xml
  13. 11
      app/src/main/res/layout/item_gas_speed.xml
  14. 7
      app/src/main/res/values-es/strings.xml
  15. 7
      app/src/main/res/values-zh/strings.xml
  16. 7
      app/src/main/res/values/strings.xml
  17. 28
      build.gradle
  18. 2
      gradle.properties

@ -4,17 +4,22 @@ package com.alphawallet.app.ui;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -30,6 +35,7 @@ import com.alphawallet.app.service.TickerService;
import com.alphawallet.app.ui.widget.divider.ListDivider;
import com.alphawallet.app.ui.widget.entity.GasSettingsCallback;
import com.alphawallet.app.ui.widget.entity.GasSpeed;
import com.alphawallet.app.ui.widget.entity.GasWarningLayout;
import com.alphawallet.app.util.BalanceUtils;
import com.alphawallet.app.util.Utils;
import com.alphawallet.app.viewmodel.GasSettingsViewModel;
@ -71,7 +77,10 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
private BigDecimal availableBalance;
private BigDecimal sendAmount;
private BigInteger customGasPriceFromWidget;
private final BigInteger minGas = BigInteger.valueOf(C.GAS_PRICE_MIN);
private GasWarningLayout gasWarning;
private GasWarningLayout insufficientWarning;
private ScrollView scroll;
private final Handler handler = new Handler();
private int customIndex = -1;
@ -86,6 +95,9 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
gasSliderView = findViewById(R.id.gasSliderView);
recyclerView = findViewById(R.id.list);
gasWarning = findViewById(R.id.gas_warning_bubble);
insufficientWarning = findViewById(R.id.insufficient_bubble);
scroll = findViewById(R.id.setting_scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
viewModel = new ViewModelProvider(this, viewModelFactory)
@ -127,6 +139,7 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
{
GasPriceSpread gs = ((RealmGasSpread) realmToken).getGasPrice();
initGasSpeeds(gs);
gasSettingsUpdate(gasSpeeds.get(customIndex).gasPrice, customGasLimit.toBigInteger());
}
});
}
@ -231,7 +244,6 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
final TextView speedCostEth;
final TextView speedCostFiat;
final TextView speedTime;
final LinearLayout blankOverlay;
final View itemLayout;
CustomViewHolder(View view)
@ -244,7 +256,6 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
speedTime = view.findViewById(R.id.text_speed_time);
itemLayout = view.findViewById(R.id.layout_list_item);
speedGwei = view.findViewById(R.id.text_gwei);
blankOverlay = view.findViewById(R.id.layout_overlay);
}
}
@ -264,12 +275,16 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
holder.itemLayout.setOnClickListener(v -> {
if (position == customIndex && currentGasSpeedIndex != customIndex)
{
if (holder.blankOverlay.getVisibility() == View.VISIBLE) { return; } //don't allow selection of invalid amount
gasSliderView.initGasLimit(customGasLimit.toBigInteger());
gasSliderView.reportPosition();
}
else if (position != customIndex && currentGasSpeedIndex == customIndex)
{
hideGasWarning();
}
currentGasSpeedIndex = position;
notifyDataSetChanged();
});
String speedGwei = BalanceUtils.weiToGweiBI(gs.gasPrice).toBigInteger().toString();
@ -291,6 +306,7 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
}
}
BigDecimal gasFee = new BigDecimal(gs.gasPrice).multiply(useGasLimit);
String gasAmountInBase = BalanceUtils.getScaledValueScientific(gasFee, baseCurrency.tokenInfo.decimals, GAS_PRECISION);
@ -318,15 +334,7 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
//determine if this amount can be used
BigDecimal txCost = gasFee.add(sendAmount);
if (txCost.compareTo(availableBalance) >= 0)
{
//cannot be used
holder.blankOverlay.setVisibility(View.VISIBLE);
}
else
{
holder.blankOverlay.setVisibility(View.GONE);
}
checkInsufficientGas(txCost);
}
private void blankCustomHolder(CustomViewHolder holder)
@ -378,8 +386,10 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
gasSliderView.initGasPriceMax(gs.gasPrice);
notice.setVisibility(View.VISIBLE);
gasSliderView.setVisibility(View.GONE);
hideGasWarning();
}
}
}
@Override
@ -410,23 +420,39 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
expectedTime = (long) ((double) lg.seconds - extrapolateFactor * timeDiff);
break;
}
else if (lg.speed.equals(getString(R.string.speed_slow)) && dGasPrice < lowerBound)
{
else if (lg.speed.equals(getString(R.string.speed_slow))) { //final entry
//danger zone - transaction may not complete
double dangerAmount = lowerBound / 2.0;
long dangerTime = 12 * DateUtils.HOUR_IN_MILLIS / 1000;
if (dGasPrice < dangerAmount)
if (dGasPrice < (lowerBound*0.95)) //only show gas warning if less than 95% of slow
{
showGasWarning(false);
}
if (dGasPrice < dangerAmount) {
expectedTime = -1; //never
} else {
expectedTime = extrapolateTime(dangerTime, lg.seconds, dGasPrice, dangerAmount, lowerBound);
}
return expectedTime;
}
else if (ug.speed.equals(getString(R.string.speed_rapid)) && dGasPrice >= upperBound)
{
if (dGasPrice > 1.4 * upperBound)
{
showGasWarning(true); //only show gas warning if greater than 140% of max needed gas
}
else
{
expectedTime = extrapolateTime(dangerTime, lg.seconds, dGasPrice, dangerAmount, lowerBound);
hideGasWarning();
}
break;
return expectedTime; //exit here so we don't hit the speed_slow catcher
}
}
hideGasWarning(); // Didn't need a gas warning: custom gas is within bounds
}
return expectedTime;
@ -441,7 +467,10 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
private void updateCustomElement(BigInteger gasPrice, BigInteger gasLimit)
{
if (customIndex < 0) return;
if (customIndex < 0)
{
return;
}
GasSpeed gs = gasSpeeds.get(customIndex);
//new settings from the slider widget
gs = new GasSpeed(gs.speed, getExpectedTransactionTime(gasPrice), gasPrice, true);
@ -450,4 +479,68 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall
this.customGasLimit = new BigDecimal(gasLimit);
}
private void showGasWarning(boolean high)
{
if (currentGasSpeedIndex != customIndex)
{
return;
}
displayGasWarning(); //if gas warning already showing, no need to take focus from user input
TextView heading = findViewById(R.id.bubble_title);
TextView body = findViewById(R.id.bubble_body);
if (high)
{
heading.setText(getString(R.string.high_gas_setting));
body.setText(getString(R.string.body_high_gas));
}
else
{
heading.setText(getString(R.string.low_gas_setting));
body.setText(getString(R.string.body_low_gas));
}
}
private void displayGasWarning()
{
if (gasWarning.getVisibility() != View.VISIBLE) //no need to re-apply
{
handler.postDelayed(() -> scroll.fullScroll(View.FOCUS_DOWN), 100);
gasWarning.setVisibility(View.VISIBLE);
EditText gas_price_entry = findViewById(R.id.gas_price_entry);
gas_price_entry.setTextColor(getColor(R.color.danger));
gas_price_entry.setBackground(ContextCompat.getDrawable(this, R.drawable.background_text_edit_error));
}
}
private void hideGasWarning()
{
gasWarning.setVisibility(View.GONE);
EditText gas_price_entry = findViewById(R.id.gas_price_entry);
gas_price_entry.setTextColor(getColor(R.color.dove));
gas_price_entry.setBackground(getDrawable(R.drawable.background_password_entry));
}
private void checkInsufficientGas(BigDecimal txCost)
{
if (txCost.compareTo(availableBalance) > 0)
{
insufficientWarning.setVisibility(View.VISIBLE);
}
else
{
insufficientWarning.setVisibility(View.GONE);
}
if (insufficientWarning.getVisibility() == View.VISIBLE && gasWarning.getVisibility() == View.VISIBLE)
{
gasWarning.setVisibility(View.GONE);
}
}
}

@ -0,0 +1,38 @@
package com.alphawallet.app.ui.widget.entity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class GasWarningLayout extends FrameLayout
{
private VisibilityCallback visibilityCallback;
public GasWarningLayout(@NonNull Context context)
{
super(context);
}
public GasWarningLayout(@NonNull Context context, @Nullable AttributeSet attrs)
{
super(context, attrs);
}
@Override
public void onVisibilityChanged(View changedView, int visibility)
{
super.onVisibilityChanged(changedView, visibility);
if (visibilityCallback != null)
{
visibilityCallback.onVisibilityChanged(visibility == View.VISIBLE);
}
}
public void setVisibilityCallback(VisibilityCallback vs)
{
visibilityCallback = vs;
}
}

@ -0,0 +1,6 @@
package com.alphawallet.app.ui.widget.entity;
public interface VisibilityCallback
{
public void onVisibilityChanged(boolean visible);
}

@ -0,0 +1,20 @@
package com.alphawallet.app.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
public class AmountDisplayWidget extends LinearLayout
{
public AmountDisplayWidget(Context context)
{
super(context);
}
public AmountDisplayWidget(Context context, @Nullable AttributeSet attrs)
{
super(context, attrs);
}
}

@ -2,6 +2,7 @@ package com.alphawallet.app.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Handler;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@ -39,6 +40,7 @@ public class GasSliderView extends RelativeLayout
private final float minimumPrice = BalanceUtils.weiToGweiBI(BigInteger.valueOf(C.GAS_PRICE_MIN)).multiply(BigDecimal.TEN).floatValue(); //minimum for slider
private float gasLimitScaleFactor;
private boolean limitInit = false;
private final Handler handler = new Handler();
private GasSettingsCallback gasCallback;
@ -136,7 +138,14 @@ public class GasSliderView extends RelativeLayout
if (gasLimitValue.hasFocus() || gasPriceValue.hasFocus())
{
limitInit = true;
updateGasControl();
handler.removeCallbacks(null);
handler.postDelayed(new Runnable() {
@Override
public void run() {
updateSliderSettingsFromText(); //ensure sliders reflect new values
updateGasControl();
}
},2000);
}
}
};
@ -164,6 +173,34 @@ public class GasSliderView extends RelativeLayout
}
}
//After user updates the gas settings, reflect the new values in the sliders
private void updateSliderSettingsFromText()
{
String gasPriceStr = gasPriceValue.getText().toString();
String gasLimitStr = gasLimitValue.getText().toString();
try
{
BigDecimal gweiPrice = new BigDecimal(gasPriceStr);
setPriceSlider(gweiPrice);
}
catch (Exception e)
{
// - user typed a number that couldn't be converted
}
try
{
BigDecimal gasLimitGwei = new BigDecimal(gasLimitStr);
int progress = (int)((float)(gasLimitGwei.longValue() - C.GAS_LIMIT_MIN)/gasLimitScaleFactor);
gasLimitSlider.setProgress(progress);
}
catch (Exception e)
{
// - no need to act
}
}
@SuppressLint("SetTextI18n")
public void initGasPrice(BigInteger price)
{

@ -4,8 +4,10 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -22,9 +24,11 @@ import com.alphawallet.app.service.TickerService;
import com.alphawallet.app.service.TokensService;
import com.alphawallet.app.ui.GasSettingsActivity;
import com.alphawallet.app.ui.widget.entity.GasSpeed;
import com.alphawallet.app.ui.widget.entity.GasWarningLayout;
import com.alphawallet.app.util.BalanceUtils;
import com.alphawallet.app.util.Utils;
import com.alphawallet.app.web3.entity.Web3Transaction;
import com.google.api.Distribution;
import java.math.BigDecimal;
import java.math.BigInteger;
@ -64,6 +68,7 @@ public class GasWidget extends LinearLayout implements Runnable
private final TextView speedText;
private final TextView timeEstimate;
private final LinearLayout gasWarning;
private LinearLayout speedWarning;
private final Context context;
private final List<GasSpeed> gasSpeeds;
@ -82,6 +87,7 @@ public class GasWidget extends LinearLayout implements Runnable
speedText = findViewById(R.id.text_speed);
timeEstimate = findViewById(R.id.text_time_estimate);
gasWarning = findViewById(R.id.layout_gas_warning);
speedWarning = findViewById(R.id.layout_speed_warning);
gasSpeeds = new ArrayList<>();
@ -167,7 +173,6 @@ public class GasWidget extends LinearLayout implements Runnable
{
customSpeedTitle = getContext().getString(R.string.speed_custom);
}
return new GasSpeed(customSpeedTitle, expectedTxTime, newGasPrice, true);
}
@ -190,6 +195,7 @@ public class GasWidget extends LinearLayout implements Runnable
currentGasSpeedIndex = gasSelectionIndex;
customNonce = nonce;
handleCustomGas(customGasPrice, customGasLimit, expectedTxTime);
handler.post(this);
}
@ -207,6 +213,7 @@ public class GasWidget extends LinearLayout implements Runnable
gasSpeeds.remove(currentGasSpeedIndex);
gasSpeeds.add(gs);
customGasLimit = custGasLimit.toBigInteger();
}
adjustedValue = calculateSendAllValue();
@ -237,12 +244,10 @@ public class GasWidget extends LinearLayout implements Runnable
if (!sufficientGas)
{
gasWarning.setVisibility(View.VISIBLE);
speedText.setVisibility(View.GONE);
}
else
{
gasWarning.setVisibility(View.GONE);
speedText.setVisibility(View.VISIBLE);
}
return sufficientGas;
@ -362,7 +367,6 @@ public class GasWidget extends LinearLayout implements Runnable
{
//
}
timeEstimate.setText(displayStr);
speedText.setText(gs.speed);
adjustedValue = calculateSendAllValue();
@ -372,7 +376,12 @@ public class GasWidget extends LinearLayout implements Runnable
functionInterface.updateAmount();
}
if (currentGasSpeedIndex == customGasSpeedIndex)
{
checkCustomGasPrice(gasSpeeds.get(customGasSpeedIndex).gasPrice);
}
checkSufficientGas();
manageWarnings();
}
public BigInteger getGasPrice(BigInteger defaultPrice)
@ -400,6 +409,75 @@ public class GasWidget extends LinearLayout implements Runnable
}
}
private void checkCustomGasPrice(BigInteger customGasPrice)
{
if (currentGasSpeedIndex != customGasSpeedIndex)
{
return;
}
if (gasSpeeds.size() <= 2)
{
return;
}
double dGasPrice = customGasPrice.doubleValue();
GasSpeed ug = gasSpeeds.get(0); //rapid
GasSpeed lg = gasSpeeds.get(gasSpeeds.size() - 2); //slow
double lowerBound = lg.gasPrice.doubleValue();
double upperBound = ug.gasPrice.doubleValue();
if (dGasPrice < lowerBound)
{
showCustomSpeedWarning(false);
}
else if (dGasPrice > 1.5 * upperBound)
{
showCustomSpeedWarning(true);
}
else
{
speedWarning.setVisibility(View.GONE);
}
}
private void showCustomSpeedWarning(boolean high)
{
if (currentGasSpeedIndex != customGasSpeedIndex)
{
return;
}
TextView warningText = findViewById(R.id.text_speed_warning);
if (high)
{
warningText.setText(getResources().getString(R.string.speed_high_gas));
}
else
{
warningText.setText(getResources().getString(R.string.speed_too_low));
}
speedWarning.setVisibility(View.VISIBLE);
}
private void manageWarnings()
{
if (gasWarning.getVisibility() == VISIBLE || speedWarning.getVisibility() == VISIBLE)
{
speedText.setVisibility(View.GONE);
if (gasWarning.getVisibility() == VISIBLE && speedWarning.getVisibility() == VISIBLE)
{
speedWarning.setVisibility(View.GONE);
}
}
else
{
speedText.setVisibility(View.VISIBLE);
}
}
public BigInteger getGasLimit()
{
return getUseGasLimit();

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dp"
android:color="@color/danger" />
<corners android:radius="4dp" />
</shape>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffebea" />
<stroke android:width="1dp" android:color="#fcbbb7"/>
<corners android:radius="8dp" />
</shape>

@ -1,36 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
android:id="@+id/setting_scroll"
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/colorPrimary"
android:orientation="vertical">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:orientation="vertical">
<include layout="@layout/layout_app_bar" />
<include layout="@layout/layout_app_bar" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/text_notice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_dove_bar"
android:paddingTop="@dimen/dp16"
android:paddingStart="@dimen/dp11"
android:paddingEnd="@dimen/dp11"
android:lineSpacingExtra="@dimen/dp5"
android:textSize="@dimen/sp13"
android:gravity="center_horizontal"
android:autoLink="web"
android:text="@string/gas_message"/>
<com.alphawallet.app.widget.GasSliderView
android:visibility="gone"
android:id="@+id/gasSliderView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.alphawallet.app.widget.GasSliderView
android:visibility="gone"
android:id="@+id/gasSliderView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/text_notice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_dove_bar"
android:paddingTop="@dimen/dp16"
android:paddingStart="@dimen/dp11"
android:paddingEnd="@dimen/dp11"
android:lineSpacingExtra="@dimen/dp5"
android:textSize="@dimen/sp13"
android:gravity="center_horizontal"
android:autoLink="web"
android:text="@string/gas_message"/>
<com.alphawallet.app.ui.widget.entity.GasWarningLayout
android:id="@+id/gas_warning_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp18"
android:visibility="gone">
<LinearLayout
android:background="@drawable/background_warning_salmon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="14dp"
android:paddingHorizontal="14dp"
android:paddingBottom="30dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_red_warning"
android:layout_margin="8dp"/>
<TextView
android:id="@+id/bubble_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/low_gas_setting"
android:textStyle="normal"
android:textSize="20sp"
android:textColor="@color/danger"
android:lineSpacingExtra="14sp"
android:gravity="center_horizontal"
android:layout_gravity="center_vertical"
android:lineHeight="34sp"/>
</LinearLayout>
<TextView
android:id="@+id/bubble_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:text="@string/body_low_gas"
android:autoLink="web"
android:textColor="@color/dove"
android:textAlignment="center"
android:textSize="15sp"/>
</LinearLayout>
</com.alphawallet.app.ui.widget.entity.GasWarningLayout>
<com.alphawallet.app.ui.widget.entity.GasWarningLayout
android:id="@+id/insufficient_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp18"
android:visibility="gone">
<LinearLayout
android:background="@drawable/background_warning_salmon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="14dp"
android:paddingHorizontal="14dp"
android:paddingBottom="30dp"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_red_warning"
android:layout_margin="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/insufficient_gas"
android:textStyle="normal"
android:textSize="20sp"
android:textColor="@color/danger"
android:lineSpacingExtra="14sp"
android:gravity="center_horizontal"
android:layout_gravity="center_vertical"
android:lineHeight="34sp"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:text="@string/body_insufficient_warning"
android:autoLink="web"
android:textColor="@color/dove"
android:textAlignment="center"
android:textSize="15sp"/>
</LinearLayout>
</com.alphawallet.app.ui.widget.entity.GasWarningLayout>
</LinearLayout>
</ScrollView>

@ -143,6 +143,7 @@
<!-- TODO: This needs to be moved into a view of its own: AmountDisplayWidget -->
<View
android:layout_width="match_parent"
android:layout_height="1dp"

@ -40,17 +40,43 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:src="@drawable/ic_red_warning"/>
<TextView
android:id="@+id/text_warning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cancel_red"
android:textColor="@color/danger"
android:fontFamily="@font/font_semibold"
android:text="@string/insufficient_gas"
android:textSize="14sp"/>
android:textSize="@dimen/sp17"/>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_speed_warning"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3.1"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:src="@drawable/ic_red_warning"/>
<TextView
android:id="@+id/text_speed_warning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/danger"
android:fontFamily="@font/font_semibold"
android:text="@string/speed_too_low"
android:textSize="@dimen/sp17"/>
</LinearLayout>
<TextView
android:id="@+id/text_speed"
android:layout_width="0dp"
@ -60,7 +86,7 @@
android:fontFamily="@font/font_semibold"
android:text="@string/speed_average"
android:gravity="start"
android:textSize="@dimen/sp16"/>
android:textSize="@dimen/sp17"/>
<TextView
android:layout_width="0dp"

@ -50,7 +50,7 @@
android:gravity="end|center_vertical"
android:textSize="@dimen/sp14"
android:paddingEnd="10dp"
android:inputType="number"
android:inputType="numberDecimal"
tools:text="20"/>

@ -6,17 +6,6 @@
android:layout_height="wrap_content"
android:background="@color/white">
<LinearLayout
android:id="@+id/layout_overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/layout_details"
android:layout_alignBottom="@id/layout_details"
android:background="@color/translucentWhite"
android:translationZ="1000dp"
android:visibility="gone"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/layout_details"
android:paddingStart="15dp"

@ -713,6 +713,13 @@
<string name="action_token_swap">Intercambio de tokens</string>
<string name="action_withdraw">Withdraw</string>
<string name="deposit">Deposit</string>
<string name="body_low_gas">Gas price is set below the \'slow\' speed.</string>
<string name="low_gas_setting">Gas Fee Might Be Too Low</string>
<string name="body_high_gas">You have set a really high gas fee. Please make sure this is not a mistake. AlphaWallet uses gasnow.org live oracle and updates the gas price every 15 sec.</string>
<string name="high_gas_setting">High Fee Warning!</string>
<string name="speed_too_low">Too Low</string>
<string name="speed_high_gas">High Fee</string>
<string name="body_insufficient_warning">Your balance has insufficient funds for the transaction value plus transaction fee.</string>
<string name="convert_to_xdai">Convert to xDAI</string>
<string name="crypto">Crypto</string>
<string name="action_buy_crypto">Buy %1$s</string>

@ -713,6 +713,13 @@
<string name="action_token_swap">通证交换</string>
<string name="action_withdraw">Withdraw</string>
<string name="deposit">Deposit</string>
<string name="body_low_gas">Gas price is set below the \'slow\' speed.</string>
<string name="low_gas_setting">Gas Fee Might Be Too Low</string>
<string name="body_high_gas">You have set a really high gas fee. Please make sure this is not a mistake. AlphaWallet uses gasnow.org live oracle and updates the gas price every 15 sec.</string>
<string name="high_gas_setting">High Fee Warning!</string>
<string name="speed_too_low">Too Low</string>
<string name="speed_high_gas">高价</string>
<string name="body_insufficient_warning">Your balance has insufficient funds for the transaction value plus transaction fee.</string>
<string name="convert_to_xdai">Convert to xDAI</string>
<string name="crypto">Crypto</string>
<string name="action_buy_crypto">Buy %1$s</string>

@ -716,6 +716,8 @@
<string name="speed_fast">Fast</string>
<string name="speed_slow">Slow</string>
<string name="speed_custom">Custom</string>
<string name="speed_too_low">Too Low</string>
<string name="speed_high_gas">High Fee</string>
<string name="speed_dapp">Dapp Settings</string>
<string name="new_balance">(New: %1$s %2$s)</string>
<string name="set_speed_title">Set Speed</string>
@ -739,6 +741,11 @@
<string name="action_token_swap">Token Swap</string>
<string name="action_withdraw">Withdraw</string>
<string name="deposit">Deposit</string>
<string name="body_low_gas">Gas price is set below the \'slow\' speed.\nYour transaction may take a long time to be written or may never be written.</string>
<string name="low_gas_setting">Gas Fee Might Be Too Low</string>
<string name="body_high_gas">You have set a really high gas fee. Please make sure this is not a mistake. AlphaWallet uses gasnow.org live oracle and updates the gas price every 15 sec.</string>
<string name="high_gas_setting">High Fee Warning!</string>
<string name="body_insufficient_warning">Your balance has insufficient funds for the transaction value plus transaction fee.</string>
<string name="convert_to_xdai">Convert to xDAI</string>
<string name="crypto">Crypto</string>
<string name="action_buy_crypto">Buy %1$s</string>

@ -1,24 +1,22 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.21'
ext.kotlin_version = '1.4.10'
repositories {
// don't add anything here until you read to the bottom of this bracket
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
// WARNING WARNING WARNING
// you are about to add here a repository which provides some library for the Android app
// don't do that. add that repository to app/build.gradle
// WARNING WARNING WARNING
// you are about to add here a repository which provides some library for the Android app
// don't do that. add that repository to app/build.gradle
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4' //NB - there is an issue with newer versions of gradle. The APK balloons out, so far haven't diagnosed why.
//If you want to try upgrading gradle plugin past 3.5.4 you will need to also diagnose the APK ballooning issue.
//If you want to try upgrading gradle plugin past 3.5.4 you will need to also diagnose the APK ballooning issue.
classpath "io.realm:realm-gradle-plugin:7.0.8"
// WARNING WARNING WARNING
// you are about to add here a dependency to be used in the Android app
// don't do that. add that dependency to app/build.gradle
// WARNING WARNING WARNING
// you are about to add here a dependency to be used in the Android app
// don't do that. add that dependency to app/build.gradle
classpath 'com.google.gms:google-services:4.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
@ -31,9 +29,9 @@ allprojects {
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
// WARNING WARNING WARNING
// you are about to add here a repository which provides some library for the Android app
// don't do that. add that repository to app/build.gradle
// WARNING WARNING WARNING
// you are about to add here a repository which provides some library for the Android app
// don't do that. add that repository to app/build.gradle
}
configurations.all {
@ -46,7 +44,3 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
// WARNING WARNING WARNING
// you are about to add here a plugin that is only related to the Android app
// don't do that. add that repository to app/build.gradle

@ -7,4 +7,4 @@
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=true
org.gradle.jvmargs=-Xms2048m -Xmx8192m
org.gradle.jvmargs=-Xms2048m -Xmx4096m
Loading…
Cancel
Save