Commit 33ae49c4 authored by fallenstardust's avatar fallenstardust

根据url判断是否显示下载按钮

parent da36e03d
package cn.garymb.ygomobile.ui.activities;
import static android.view.View.VISIBLE;
import static cn.garymb.ygomobile.Constants.URL_YGO233_ADVANCE;
import android.content.Context;
import android.content.Intent;
......@@ -21,7 +21,7 @@ public class WebActivity extends BaseActivity {
private WebViewPlus mWebViewPlus;
private String mUrl;
private String mTitle;
private static Button btn_download;
private Button btn_download;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
......@@ -46,6 +46,11 @@ public class WebActivity extends BaseActivity {
});*/
if (doIntent(getIntent())) {
mWebViewPlus.loadUrl(mUrl);
if (mUrl.equals(URL_YGO233_ADVANCE)) {
btn_download.setVisibility(View.VISIBLE);
} else {
btn_download.setVisibility(View.GONE);
}
}
}
......@@ -126,15 +131,7 @@ public class WebActivity extends BaseActivity {
context.startActivity(intent);
}
public static void open(Context context, String title, String url, boolean showButton) {
open(context, title, url);
if (showButton){
btn_download.setVisibility(VISIBLE);
}
}
public static void openFAQ(Context context, Card cardInfo){
public static void openFAQ(Context context, Card cardInfo) {
String uri = Constants.WIKI_SEARCH_URL + String.format("%08d", cardInfo.getCode());
WebActivity.open(context, cardInfo.Name, uri);
}
......
......@@ -338,7 +338,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
}
break;
case R.id.action_download_ex:
WebActivity.open(this, getString(R.string.action_download_expansions), Constants.URL_YGO233_ADVANCE, true);
WebActivity.open(this, getString(R.string.action_download_expansions), Constants.URL_YGO233_ADVANCE);
break;
case R.id.action_card_search:
startActivity(new Intent(this, CardSearchActivity.class));
......
......@@ -9,7 +9,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/addserver"
android:gravity="center|top"
android:gravity="center"
android:text="@string/action_add_server"
android:textSize="10sp"
android:textColor="@color/selector_text_color_white_gold"></TextView>
</LinearLayout>
\ No newline at end of file
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