If you think the Android project openaccessbutton 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 org.openaccessbutton.openaccessbutton.intro;
/*fromwww.java2s.com*/import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import org.openaccessbutton.openaccessbutton.R;
import org.openaccessbutton.openaccessbutton.menu.MenuActivity;
publicclass LaunchActivity extends Activity {
@Override
protectedvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launch);
// Check if the user's already signed in
SharedPreferences prefs = getSharedPreferences("org.openaccessbutton.openaccessbutton", 0);
String apiKey = prefs.getString("api_key", "");
if (apiKey.length() > 0) {
// Go to MenuActivity
Intent k = new Intent(this, MenuActivity.class);
startActivity(k);
finish();
}
// Make privacy links clickable
TextView privacyView = (TextView) findViewById(R.id.privacy_text);
privacyView.setMovementMethod(LinkMovementMethod.getInstance());
// Set button callbacks
final Context context = this;
findViewById(R.id.signinButton).setOnClickListener(new View.OnClickListener() {
@Override
publicvoid onClick(View view) {
Intent k = new Intent(context, SigninActivity.class);
startActivity(k);
}
});
findViewById(R.id.signupButton).setOnClickListener(new View.OnClickListener() {
@Override
publicvoid onClick(View view) {
Intent k = new Intent(context, SignupActivity.class);
startActivity(k);
}
});
}
@Override
publicboolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.launch, menu);
return true;
}
@Override
publicboolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}