Я удалил AdMob из моего исходного кода Android Studio, но, тем не менее, он показывает пустое место внизу в приложении.
Он всегда занимает пустое место внизу.Я не знаю, как заставить это нижнее пространство полностью исчезнуть и показать обычный предварительный просмотр приложения без рекламы.
Как я могу это сделать?
Вот код.
Mainactivity.java
package com.dshgh.webview;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.dshgh.webview.Fragments.WebViewFragment;
public class MainActivity extends AppCompatActivity {
private BroadcastReceiver mRegistrationBroadcastReceiver;
boolean doubleBackToExitPressedOnce = false;
private FirebaseAnalytics mFirebaseAnalytics;
RelativeLayout rel_layout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
//ButterKnife.bind(this);
rel_layout = (RelativeLayout)findViewById(R.id.rel_layout);
// Obtain the FirebaseAnalytics instance.
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
WebViewFragment webViewFragment = new WebViewFragment();
bundle.putString("url", Config.homeUrl);
webViewFragment.setArguments(bundle);
loadFragment(webViewFragment, false, "webViewFragment");
try {
Intent intent = getIntent();
String message = intent.getStringExtra("message");
String url = intent.getStringExtra("url");
Log.d("notification Data", message + url);
if (url.length() > 0) {
bundle.putString("url", url);
webViewFragment.setArguments(bundle);
loadFragment(webViewFragment, false, "webViewFragment");
}
}
catch (Exception e) {
Log.d("error notification data", e.toString());
}
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
displayFirebaseRegId();
}
private void displayFirebaseRegId() {
SharedPreferences pref = getApplicationContext().getSharedPreferences(Config.SHARED_PREF, 0);
String regId = pref.getString("regId", null);
Log.e("FCM", "Firebase reg id: " + regId);
if (!TextUtils.isEmpty(regId)) {
//txtRegId.setText("Firebase Reg Id: " + regId);
}
else
Log.d("Firebase", "Firebase Reg Id is not received yet!");
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
LocalBroadcastManager.getInstance(this).unregisterReceiver(mRegistrationBroadcastReceiver);
super.onPause();
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onBackPressed() {
Fragment fragment = getSupportFragmentManager().findFragmentByTag("webViewFragment");
if(fragment != null && fragment instanceof WebViewFragment) {
if(((WebViewFragment) fragment).onBackPressed()) {
if (doubleBackToExitPressedOnce) {
super.onBackPressed();
return;
}
this.doubleBackToExitPressedOnce = true;
// Toast.makeText(this, "Press back once more to exit", Toast.LENGTH_SHORT).show();
Snackbar snackbar = Snackbar
.make(rel_layout, "Press back once more to exit", Snackbar.LENGTH_LONG);
snackbar.setActionTextColor(Color.RED);
View snackbarView = snackbar.getView();
snackbarView.setBackgroundColor(Color.DKGRAY);
TextView textView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text);
textView.setTextColor(Color.YELLOW);
snackbar.show();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doubleBackToExitPressedOnce = false;
}
}, 2000);
}
}
}
public void loadFragment(Fragment fragment, Boolean bool) {
loadFragment(fragment, bool, null);
}
public void loadFragment(Fragment fragment, Boolean bool, String TAG) {
showAds();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
if(TAG == null) {
transaction.replace(R.id.frameLayout, fragment);
}else {
transaction.replace(R.id.frameLayout, fragment, TAG);
}
if (bool)
transaction.addToBackStack(null);
transaction.commit();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
Fragment fragment = getSupportFragmentManager().findFragmentByTag("webViewFragment");
if(fragment != null && fragment instanceof WebViewFragment) {
((WebViewFragment)fragment).onActivityResult(requestCode, resultCode, intent);
}
super.onActivityResult(requestCode, resultCode, intent);
}
public void hideAds() {
}
public void showAds() {
}
}