Commit 0bb17bb0 authored by fallenstardust's avatar fallenstardust

showToast显示位置都改为屏幕顶部

parent 2355394b
...@@ -12,6 +12,7 @@ import android.os.Build; ...@@ -12,6 +12,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Looper; import android.os.Looper;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
...@@ -331,6 +332,7 @@ public class BaseActivity extends AppCompatActivity { ...@@ -331,6 +332,7 @@ public class BaseActivity extends AppCompatActivity {
} }
Toast toast = makeToast(); Toast toast = makeToast();
toast.setText(text); toast.setText(text);
toast.setGravity(Gravity.TOP, 0, 0);
toast.setDuration(duration); toast.setDuration(duration);
toast.show(); toast.show();
} }
......
...@@ -605,9 +605,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte ...@@ -605,9 +605,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
if (checkLimit(cardInfo)) { if (checkLimit(cardInfo)) {
boolean rs = mDeckAdapater.AddCard(cardInfo, DeckItemType.SideCard); boolean rs = mDeckAdapater.AddCard(cardInfo, DeckItemType.SideCard);
if (rs) { if (rs) {
Toast.makeText(getContext(), R.string.add_card_tip_ok, Toast.LENGTH_SHORT).show(); activity.showToast(R.string.add_card_tip_ok);
} else { } else {
Toast.makeText(getContext(), R.string.add_card_tip_fail, Toast.LENGTH_SHORT).show(); activity.showToast(R.string.add_card_tip_fail);
} }
return rs; return rs;
} }
...@@ -623,9 +623,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte ...@@ -623,9 +623,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
rs = mDeckAdapater.AddCard(cardInfo, DeckItemType.MainCard); rs = mDeckAdapater.AddCard(cardInfo, DeckItemType.MainCard);
} }
if (rs) { if (rs) {
Toast.makeText(getContext(), R.string.add_card_tip_ok, Toast.LENGTH_SHORT).show(); activity.showToast(R.string.add_card_tip_ok);
} else { } else {
Toast.makeText(getContext(), R.string.add_card_tip_fail, Toast.LENGTH_SHORT).show(); activity.showToast(R.string.add_card_tip_fail);
} }
return rs; return rs;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment