If you think the Android project Android-Apps listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.kniezrec.voiceremotefree;
//www.java2s.comimport com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.text.Html.ImageGetter;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
publicclass HelpActivity extends Activity {
static ImageGetter imgGetter;
private AdView adView;
@Override
protectedvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
getActionBar().setDisplayHomeAsUpEnabled(true);
TextView help = (TextView) findViewById(R.id.helpTextV);
String _help = getResources().getString(R.string.helpText);
imgGetter = new Html.ImageGetter() {
@Override
public Drawable getDrawable(String source) {
int id;
if (source.equals("expand.png")) {
id = R.drawable.expand;
} elseif (source.equals("hdmi.png")) {
id = R.drawable.hdmi;
} elseif (source.equals("src.png")) {
id = R.drawable.src;
} elseif (source.equals("chlist.png")) {
id = R.drawable.chlist;
} elseif (source.equals("list.png")) {
id = R.drawable.list;
} else {
return null;
}
Drawable d = getResources().getDrawable(id);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d;
}
};
help.setText(Html.fromHtml(_help, imgGetter, null));
adView = new AdView(HelpActivity.this, AdSize.BANNER, "a150fe909848614");
adView.loadAd(new AdRequest());
}
@Override
publicvoid onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
@Override
publicboolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_help, menu);
return true;
}
@Override
publicboolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
super.onBackPressed();
return true;
case R.id.menu_settings:
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
return true;
case R.id.pro_link:
createDialog();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
privatevoid createDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.FullTitle);
builder.setMessage(R.string.desc);
builder.setPositiveButton(R.string.buy,
new DialogInterface.OnClickListener() {
publicvoid onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri
.parse("market://details?id=com.kniezrec.voiceremote"));
startActivity(intent);
}
});
builder.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
publicvoid onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
// Create the AlertDialog
AlertDialog dialog = builder.create();
dialog.show();
}
}