use of android.view.View.OnClickListener in project nmid-headline by miao1007.
the class EditPage method initAtUserView.
private void initAtUserView() {
LinearLayout atLayout = (LinearLayout) findViewByResName("atLayout");
for (Platform platform : platforms) {
String platformName = platform.getName();
if (isShowAtUserLayout(platformName)) {
View view = LayoutInflater.from(activity).inflate(getLayoutRes(activity, "skyblue_editpage_at_layout"), null);
TextView atDescTextView = (TextView) view.findViewById(getIdRes(activity, "atDescTextView"));
TextView atTextView = (TextView) view.findViewById(getIdRes(activity, "atTextView"));
OnClickListener atBtnClickListener = new OnClickListener() {
public void onClick(View v) {
FollowListPage subPage = new FollowListPage();
subPage.setPlatform((Platform) v.getTag());
subPage.showForResult(activity, null, EditPage.this);
}
};
atTextView.setTag(platform);
atTextView.setOnClickListener(atBtnClickListener);
atDescTextView.setTag(platform);
atDescTextView.setOnClickListener(atBtnClickListener);
atTextView.setText(getAtUserButtonText(platformName));
atDescTextView.setText(getContext().getString(getStringRes(activity, "list_friends"), getLogoName(platformName)));
atLayout.addView(view);
}
}
}
use of android.view.View.OnClickListener in project nmid-headline by miao1007.
the class EditPage method getAtLine.
// if platform selected form platform gridview is SinaWeibo,
// TencentWeibo, Facebook, or Twitter, there will be a button
// in the left-bottom of the page, which provides At-friends function
private LinearLayout getAtLine(String platform) {
if (!isShowAtUserLayout(platform)) {
return null;
}
LinearLayout llAt = new LinearLayout(getContext());
LayoutParams lpAt = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpAt.rightMargin = dipToPx(getContext(), 4);
lpAt.gravity = Gravity.LEFT | Gravity.BOTTOM;
lpAt.weight = 1;
llAt.setLayoutParams(lpAt);
llAt.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
FollowListPage subPage = new FollowListPage();
subPage.setPlatform(platforms.get(0));
subPage.showForResult(activity, null, EditPage.this);
}
});
TextView tvAt = new TextView(getContext());
int resId = getBitmapRes(activity, "btn_back_nor");
if (resId > 0) {
tvAt.setBackgroundResource(resId);
}
int dp_32 = dipToPx(getContext(), 32);
tvAt.setLayoutParams(new LayoutParams(dp_32, dp_32));
tvAt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
tvAt.setText(getAtUserButtonText(platform));
int dp_2 = dipToPx(getContext(), 2);
tvAt.setPadding(0, 0, 0, dp_2);
tvAt.setTypeface(Typeface.DEFAULT_BOLD);
tvAt.setTextColor(0xff000000);
tvAt.setGravity(Gravity.CENTER);
llAt.addView(tvAt);
TextView tvName = new TextView(getContext());
tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
tvName.setTextColor(0xff000000);
resId = getStringRes(activity, "list_friends");
String text = getContext().getString(resId, getName(platform));
tvName.setText(text);
LayoutParams lpName = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpName.gravity = Gravity.CENTER_VERTICAL;
tvName.setLayoutParams(lpName);
llAt.addView(tvName);
return llAt;
}
use of android.view.View.OnClickListener in project aFileChooser by iPaulPro.
the class FileChooserExampleActivity method onCreate.
// code
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create a simple button to start the file chooser process
Button button = new Button(this);
button.setText(R.string.choose_file);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Display the file chooser dialog
showChooser();
}
});
setContentView(button);
}
use of android.view.View.OnClickListener in project ScrollableTabHost-for-Android by honcheng.
the class ProjectList method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
context = this;
Button button = (Button) findViewById(R.id.getSourceButton);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://code.google.com/p/mobyfactory-uiwidgets-android/"));
context.startActivity(intent);
}
});
intentsArray = new ArrayList();
// show scrollable tabhost demo
IntentObject demoScrollabelTabHost = new IntentObject();
demoScrollabelTabHost.title = "Scrollable TabHost";
demoScrollabelTabHost.description = "com.mobyfactory.scrollabletabhost";
demoScrollabelTabHost.intent = new Intent(this, DemoList_ScrollableTabHost.class);
intentsArray.add(demoScrollabelTabHost);
setListAdapter(new EfficientAdapter(this));
}
use of android.view.View.OnClickListener in project AndroidTraining by mixi-inc.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.DialogFragment).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showMyDialogFragment();
}
});
findViewById(R.id.AlertMyDialogFragment).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showAlertMyDialogFragment();
}
});
findViewById(R.id.ErrorMyAlertDialogFragment).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showErrorMyAlertDialogFragment();
}
});
}
Aggregations