Gradle version updates, remove ads, and other changes for successful compilations.
This commit is contained in:
@@ -10,23 +10,19 @@ import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.AdView;
|
||||
import com.google.android.gms.ads.MobileAds;
|
||||
|
||||
/**
|
||||
* Created by ling on 12/22/16.
|
||||
*/
|
||||
|
||||
public class OptionsActivity extends AppCompatActivity {
|
||||
|
||||
private String sharedPreferencesKey, adsKey, higherQualityKey, fpsKey;
|
||||
private String sharedPreferencesKey, higherQualityKey, fpsKey;
|
||||
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
private RelativeLayout layoutAds, layoutHigherQuality, layoutFPS;
|
||||
private CheckBox cbAds, cbHigherQuality, cbFPS;
|
||||
private boolean adsEnabled, higherQualityEnabled, fpsEnabled;
|
||||
private RelativeLayout layoutHigherQuality, layoutFPS;
|
||||
private CheckBox cbHigherQuality, cbFPS;
|
||||
private boolean higherQualityEnabled, fpsEnabled;
|
||||
|
||||
private Button btnDeletePreferences, btnConfirmDeletePreferences;
|
||||
|
||||
@@ -42,24 +38,6 @@ public class OptionsActivity extends AppCompatActivity {
|
||||
sharedPreferencesKey = getString(R.string.sharedPreferencesKey);
|
||||
sharedPreferences = getSharedPreferences(sharedPreferencesKey, MODE_PRIVATE);
|
||||
|
||||
// Set up Ads
|
||||
adsKey = getString(R.string.adsKey);
|
||||
layoutAds = (RelativeLayout) findViewById(R.id.optionAdsLayout);
|
||||
cbAds = (CheckBox) findViewById(R.id.optionAdsCheckBox);
|
||||
layoutAds.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
flipOption(adsKey);
|
||||
}
|
||||
});
|
||||
cbAds.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
flipOption(adsKey);
|
||||
}
|
||||
});
|
||||
setAds();
|
||||
|
||||
// Higher Quality Content
|
||||
higherQualityKey = getString(R.string.higherQualityKey);
|
||||
layoutHigherQuality = (RelativeLayout) findViewById(R.id.optionHigherQualityLayout);
|
||||
@@ -123,10 +101,7 @@ public class OptionsActivity extends AppCompatActivity {
|
||||
editor.apply();
|
||||
|
||||
// Change the box
|
||||
if (key.equals(adsKey)){
|
||||
setAds();
|
||||
}
|
||||
else if (key.equals(higherQualityKey)){
|
||||
if (key.equals(higherQualityKey)){
|
||||
setHigherQuality();
|
||||
}
|
||||
else if (key.equals(fpsKey)){
|
||||
@@ -134,31 +109,6 @@ public class OptionsActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void setAds(){
|
||||
adsEnabled = sharedPreferences.getBoolean(adsKey, false);
|
||||
cbAds.setChecked(adsEnabled);
|
||||
toggleAds();
|
||||
}
|
||||
|
||||
private void toggleAds(){
|
||||
// Enable ads?
|
||||
adsEnabled = sharedPreferences.getBoolean(adsKey, false);
|
||||
AdView mAdView = (AdView) findViewById(R.id.adViewOptions);
|
||||
if (adsEnabled) {
|
||||
mAdView.setVisibility(View.VISIBLE);
|
||||
MobileAds.initialize(getApplicationContext(), "ca-app-pub-3940256099942544~3347511713");
|
||||
AdRequest adRequest = new AdRequest.Builder()
|
||||
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
|
||||
.addTestDevice("C6A494DC6E7C9AC29102694D48487084") // Nexus 7
|
||||
.addTestDevice("6545BCC9B60A394005546783687339B7") // Moto G
|
||||
.build();
|
||||
mAdView.loadAd(adRequest);
|
||||
}
|
||||
else{
|
||||
mAdView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHigherQuality() {
|
||||
higherQualityEnabled = sharedPreferences.getBoolean(higherQualityKey, false);
|
||||
cbHigherQuality.setChecked(higherQualityEnabled);
|
||||
|
Reference in New Issue
Block a user