@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.carbon_cycle_view, container, false); TextView diagramTxt = (TextView) view.findViewById(R.id.txt_diagram); TextView savedScoreTxt = (TextView) view.findViewById(R.id.score_saved); Button startBtn = (Button) view.findViewById(R.id.go_diagram_btn); diagramTxt.setTypeface(tfThin); startBtn.setTypeface(tfThin); savedScoreTxt.setText((int) ((score / GAME_SCORE) * 100) + "% Sucess"); startBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent carbonIntent = new Intent(getActivity(), DiagramPlayCarbonCycle.class); carbonIntent.putExtra("SOURCE", "Fragment"); carbonIntent.putExtra("TRY_CYCLE", 0); carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); carbonIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(carbonIntent); } }); return view; }
private void openDialog() { final Dialog dialog = new Dialog(ActivityBrightness.this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_menu); dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; Button ButtonInfo = (Button) dialog.getWindow().findViewById(R.id.button1); Button ButtonMenuCancel = (Button) dialog.getWindow().findViewById(R.id.ButtonMenuCancel); Button ButtonMenuSettings = (Button) dialog.getWindow().findViewById(R.id.ButtonMenuSettings); ButtonMenuSettings.setTypeface(typefaceRoman); ButtonMenuCancel.setTypeface(typefaceMedium); ButtonInfo.setTypeface(typefaceRoman); ButtonInfo.setText(R.string.menu_info_main); ButtonMenuCancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ButtonMenuSettings.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { launchIntent(); } }); dialog.show(); }
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_no_internet); Log.d(TAG, "onCreate"); // set notification bar color in lollipop and above version int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP) { Window window = InternetConnectionActivity.this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(getResources().getColor(R.color.notification_baf_color)); } // get view of this screen. mOk = (Button) findViewById(R.id.btnInternetOk); mTryAgain = (Button) findViewById(R.id.btnInternetTryAgain); TextView txt1 = (TextView) findViewById(R.id.txtInternet1); TextView txt2 = (TextView) findViewById(R.id.txtInternet2); // set custom font on all view. mOk.setTypeface(Constant.getFontSemiBold(this)); mTryAgain.setTypeface(Constant.getFontSemiBold(this)); txt1.setTypeface(Constant.getFontSemiBold(this)); txt2.setTypeface(Constant.getFontNormal(this)); // set listener to button mOk.setOnClickListener(this); mOk.setOnTouchListener(this); mTryAgain.setOnClickListener(this); mTryAgain.setOnTouchListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); etcriteria = (EditText) findViewById(R.id.etcriteria); addsubj = (Button) findViewById(R.id.button); TextView tv = (TextView) findViewById(R.id.showcriteriatv); l = (LinearLayout) findViewById(R.id.mainll); save = (Button) findViewById(R.id.bsavefirst); MaterialTextField mv = (MaterialTextField) findViewById(R.id.materialtv); Typeface custom_font = Typeface.createFromAsset(getAssets(), "android.ttf"); save.setTypeface(custom_font); tv.setTypeface(custom_font); addsubj.setTypeface(custom_font); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar7); setSupportActionBar(toolbar); save.setOnClickListener(this); addsubj.setOnClickListener(this); etArray = new ArrayList<EditText>(); sp = getSharedPreferences("calendar", 0); SharedPreferences.Editor editor = sp.edit(); editor.putInt("days", 0); editor.commit(); Bundle back = getIntent().getExtras(); if (!back.getBoolean("show", true)) { etcriteria.setVisibility(View.GONE); tv.setVisibility(View.GONE); mv.setVisibility(View.GONE); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } }
// called when the alert dialog (mAlertDialog) is displayed @Override public void onShow(DialogInterface dialog) { // link the layout objects to the corresponding dialog-ui elements Button negativeButton = ((AlertDialog) dialog).getButton(BUTTON_NEGATIVE); Button neutralButton = ((AlertDialog) dialog).getButton(BUTTON_NEUTRAL); Button positiveButton = ((AlertDialog) dialog).getButton(BUTTON_POSITIVE); TextView dialogText = (TextView) ((AlertDialog) dialog).findViewById(android.R.id.message); // set the parameters for the negative button, if exists if (negativeButton != null) { negativeButton.setTypeface(Typeface.create(mButtonTextFont, mButtonTypefaceStyle)); negativeButton.setTextColor(mButtonTextColor); } // set the parameters for the neutral button, if exists if (neutralButton != null) { neutralButton.setTypeface(Typeface.create(mButtonTextFont, mButtonTypefaceStyle)); neutralButton.setTextColor(mButtonTextColor); } // set the parameters for the positive button, if exists if (positiveButton != null) { positiveButton.setTypeface(Typeface.create(mButtonTextFont, mButtonTypefaceStyle)); positiveButton.setTextColor(mButtonTextColor); } // set the arguments for the displayed text message if (dialogText != null) { dialogText.setTypeface(Typeface.create(mMessageTextFont, mMessageTypefaceStyle)); dialogText.setTextColor(mMessageTextColor); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cancellation_confirmed); img_Back = (ImageView) findViewById(R.id.img_Back); img_Back.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(CancellationConfirmedActivity.this, MainActivity.class); startActivity(i); finish(); } }); img_Check_mark = (ImageView) findViewById(R.id.img_Check_mark); txt_hearder = (TextView) findViewById(R.id.txt_hearder); txt_Cancellation_Confirm = (TextView) findViewById(R.id.txt_Cancellation_Confirm); btn_Keep_shopping = (Button) findViewById(R.id.btn_Keep_shopping); btn_View_all_orders = (Button) findViewById(R.id.btn_View_all_orders); Roboto_medium = Typeface.createFromAsset(getAssets(), "Roboto-Medium.ttf"); Roboto_regular = Typeface.createFromAsset(getAssets(), "Roboto-Regular.ttf"); txt_hearder.setTypeface(Roboto_medium); txt_Cancellation_Confirm.setTypeface(Roboto_regular); btn_Keep_shopping.setTypeface(Roboto_regular); btn_View_all_orders.setTypeface(Roboto_regular); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); back = (ImageView) findViewById(R.id.back); loginTitle = (TextView) findViewById(R.id.title); signIn = (Button) findViewById(R.id.signin); registerButton = (Button) findViewById(R.id.register); forgetPassword = (TextView) findViewById(R.id.forget); username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); userType = getIntent().getStringExtra("user"); back.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); loginTitle.setText(userType + " Login"); loginTitle.setTypeface(PrefUtils.getNexaLight(LoginActivity.this)); username.setTypeface(PrefUtils.getNexaLight(LoginActivity.this)); password.setTypeface(PrefUtils.getNexaLight(LoginActivity.this)); signIn.setTypeface(PrefUtils.getNexaLight(LoginActivity.this)); forgetPassword.setTypeface(PrefUtils.getNexaLight(LoginActivity.this)); registerButton.setTypeface(PrefUtils.getNexaBold(LoginActivity.this)); signIn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (validationDone()) { callWebService(userEmail, userPassword, userType); } // Functions.fireIntent(LoginActivity.this, MyDrawerActivity.class); } }); registerButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(LoginActivity.this, RegisterActivity.class); i.putExtra("user", userType); startActivity(i); } }); forgetPassword.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(LoginActivity.this, ForgotPassword.class); i.putExtra("user", userType); startActivity(i); } }); }
public void loadActivity() { setContentView(R.layout.activity_search_screen); EditText e1 = (EditText) findViewById(R.id.country); TextView e2 = (TextView) findViewById(R.id.min_price); TextView e3 = (TextView) findViewById(R.id.max_price); TextView e4 = (TextView) findViewById(R.id.startDate1); TextView e5 = (TextView) findViewById(R.id.startDate2); TextView e6 = (TextView) findViewById(R.id.endDate1); TextView e7 = (TextView) findViewById(R.id.endDate2); Button e8 = (Button) findViewById(R.id.get_check_in); Button e9 = (Button) findViewById(R.id.get_check_out); Button e10 = (Button) findViewById(R.id.ext_search); Button e11 = (Button) findViewById(R.id.search); Typeface face = Typeface.createFromAsset(getAssets(), "Raleway-Light.ttf"); /*if(getLang().equals("EN")){ face = Typeface.createFromAsset(getAssets(), "Raleway-Light.ttf"); }else face = Typeface.createFromAsset(getAssets(), "OpenSans-Light.ttf");*/ final ViewGroup layout = (ViewGroup) findViewById(R.id.main_layout); e1.setTypeface(face); e2.setTypeface(face); e3.setTypeface(face); e4.setTypeface(face); e5.setTypeface(face); e6.setTypeface(face); e7.setTypeface(face); e8.setTypeface(face); e9.setTypeface(face); e10.setTypeface(face); e11.setTypeface(face); String[] spin_arry = getResources().getStringArray(R.array.tour_types); this.mAdapter = new CustomArrayAdapter<CharSequence>(this, spin_arry); Spinner spinner = (Spinner) findViewById(R.id.tour_type); spinner.setAdapter(this.mAdapter); final RangeSeekBar<Integer> seekBar = new RangeSeekBar<Integer>(0, 2000, getBaseContext()); seekBar.setPadding(0, 0, 0, 0); seekBar.setOnRangeSeekBarChangeListener( new OnRangeSeekBarChangeListener<Integer>() { @Override public void onRangeSeekBarValuesChanged( RangeSeekBar<?> bar, Integer minValue, Integer maxValue) { // handle changed range values TextView minPrice = (TextView) findViewById(R.id.min_price); TextView maxPrice = (TextView) findViewById(R.id.max_price); minPrice.setText(minValue + "$"); maxPrice.setText(maxValue + "$"); Log.i(null, "User selected new range values: MIN=" + minValue + ", MAX=" + maxValue); } }); layout.addView(seekBar, 3); }
protected void setFontForDialog(AlertDialog d) { Button b = d.getButton(AlertDialog.BUTTON_POSITIVE); if (b != null) b.setTypeface(unispace); b = d.getButton(AlertDialog.BUTTON_NEGATIVE); if (b != null) b.setTypeface(unispace); // nice hack to get the message in the dialog TextView t = (TextView) d.findViewById(android.R.id.message); if (t != null) t.setTypeface(unispace); }
/** * User clicked clock in. If the user has setting to auto clock in then just clock in. Otherwise * open dialog to choose time. */ private void clickedClockIn() { if (sp.getBoolean(Constants.PREFS_AUTO_CLOCK_IN, false)) { startNewClock(true); } else { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.layout_clock_in); Button btnCancel = (Button) dialog.findViewById(R.id.btnCancel); Button btnNow = (Button) dialog.findViewById(R.id.btnClockInNow); Button btnOffset = (Button) dialog.findViewById(R.id.btnClockInOffset); TextView adress = (TextView) dialog.findViewById(R.id.twAdress); adress.setTypeface(abel); btnNow.setTypeface(abel); btnOffset.setTypeface(abel); btnCancel.setTypeface(abel); btnCancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); btnNow.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { startNewClock(false); dialog.dismiss(); } }); btnOffset.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { startNewClock(true); dialog.dismiss(); } }); twAdress = (TextView) dialog.findViewById(R.id.twClockInAdress); twHint = (TextView) dialog.findViewById(R.id.hint); twHint.setTypeface(abel); twAdress.setTypeface(abel); Log.d(TAG, "nhood:" + myCurrentNeighborHood + " and:" + myCurrentAdress); if (!myCurrentNeighborHood.equalsIgnoreCase(myCurrentAdress) || myCurrentNeighborHood != null) { twAdress.setText(myCurrentAdress + "\n" + myCurrentNeighborHood); } else { twAdress.setText(myCurrentAdress); } dialog.setCancelable(false); dialog.show(); } }
public SettingsDialog(Context context) { super(context, R.style.FullscreenDialogTheme); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.settings_dialog); settings = context.getSharedPreferences("NotifyMeSettings", context.MODE_PRIVATE); prefEditor = settings.edit(); Typeface font = Typeface.createFromAsset(context.getAssets(), "fonts/VarelaRound-Regular.ttf"); Typeface font2 = Typeface.createFromAsset(context.getAssets(), "fonts/DINEngschrift-Regular.ttf"); dialogText = (TextView) findViewById(R.id.settings_header); dialogText.setTypeface(font); deleteAllButton = (Button) findViewById(R.id.delete_all); deleteAllButton.setTypeface(font2); saveButton = (Button) findViewById(R.id.save_button); saveButton.setTypeface(font2); toneBox = (CheckBox) findViewById(R.id.toneCheckBox); vibrateBox = (CheckBox) findViewById(R.id.vibrateCheckBox); toneBox.setTypeface(font); vibrateBox.setTypeface(font); if (settings.contains("tone") == false) { toneBox.setChecked(true); } else { if (settings.getBoolean("tone", true)) { toneBox.setChecked(true); } else { toneBox.setChecked(false); } } if (settings.contains("vibration") == false) { vibrateBox.setChecked(true); } else { if (settings.getBoolean("vibration", true)) { vibrateBox.setChecked(true); } else { vibrateBox.setChecked(false); } } saveButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { prefEditor.putBoolean("tone", toneBox.isChecked()); prefEditor.putBoolean("vibration", vibrateBox.isChecked()); prefEditor.commit(); cancel(); } }); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home); final Button syncButton = (Button) findViewById(R.id.sync_btn); final Button acctButton = (Button) findViewById(R.id.account_btn); final Button searchButton = (Button) findViewById(R.id.search_btn); final Button aboutButton = (Button) findViewById(R.id.about_btn); Typeface type = Typeface.createFromAsset(getAssets(), "CaviarDreams_Bold.ttf"); syncButton.setTypeface(type); acctButton.setTypeface(type); searchButton.setTypeface(type); aboutButton.setTypeface(type); syncButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { progDailog = ProgressDialog.show( HomeActivity.this, "Synchronizing recipes", "Please wait...", true); new Thread() { public void run() { try { JsonParser jp = new JsonParser(new RecipeDbAdapter(HomeActivity.this)); jp.parseToDatabase(getResources().getText(R.string.allrecipes_url)); } catch (Exception e) { } progDailog.dismiss(); } }.start(); } }); searchButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent().setClass(v.getContext(), OnlineSearchActivity.class); startActivity(myIntent); } }); aboutButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { Dialog dialog = new Dialog(HomeActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(R.layout.custom_dialog); dialog.show(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_conference_code); btn_cancel = (Button) findViewById(R.id.button_cancel); txt_code = (TextView) findViewById(R.id.textView_conference_code); edit_code = (EditText) findViewById(R.id.editText_code); btn_join_in = (Button) findViewById(R.id.button_join_in); btn_cancel.setTypeface(Global.face, Typeface.BOLD); txt_code.setTypeface(Global.face); edit_code.setTypeface(Global.face, Typeface.BOLD); btn_join_in.setTypeface(Global.face, Typeface.BOLD); btn_cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub finish(); Intent intent = new Intent(JoinConferenceActivity.this, MainActivity.class); startActivity(intent); } }); btn_join_in.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (edit_code.getText().toString().length() > 0) { progressView.setVisibility(0); disableButtons(); JoinConf joinConf = new JoinConf(edit_code.getText().toString()); joinConf.execute(); } else { Toast.makeText( JoinConferenceActivity.this, "Please input conference code.", Toast.LENGTH_LONG) .show(); } Log.d(TAG, "Any Conference!"); } }); progressView = (FrameLayout) findViewById(R.id.progressView); progressView.setVisibility(4); }
void showIssues() { if (flipper.getCurrentView() != flipper.getChildAt(1)) { flipper.setInAnimation(getContext(), R.anim.slide_in_right); flipper.setOutAnimation(getContext(), R.anim.slide_out_left); flipper.showPrevious(); } disambigHeading.setTypeface(null, Typeface.NORMAL); disambigHeading.setEnabled(true); issuesHeading.setTypeface(null, Typeface.BOLD); issuesHeading.setEnabled(false); }
@AfterViews public void listAllAmbassadorsByPagination() { Typeface typeFace = Typeface.createFromAsset(getActivity().getAssets(), "fonts/OpenSans-Regular.ttf"); thousand.setTypeface(null, typeFace.BOLD); hubName.setTypeface(typeFace); ambassadorsTitle.setTypeface(typeFace); eventsButton.setTypeface(typeFace); membersButton.setTypeface(typeFace); newsButton.setTypeface(typeFace); headerHub.getBackground().setAlpha(100); android.support.v4.app.FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); OneHubNewsFragment_ newsFragment = (OneHubNewsFragment_) fragmentManager.findFragmentByTag("news"); OneHubEventsFragment_ eventsFragment = (OneHubEventsFragment_) fragmentManager.findFragmentByTag("events"); OneHubMembersFragment_ membersFragment = (OneHubMembersFragment_) fragmentManager.findFragmentByTag("members"); android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); if (newsFragment != null) { fragmentTransaction.detach(newsFragment); } if (eventsFragment != null) { fragmentTransaction.detach(eventsFragment); } if (membersFragment != null) { fragmentTransaction.detach(membersFragment); } fragmentTransaction.add(R.id.realtabcontent, new OneHubNewsFragment_(), "news"); eventsButtonLight.setBackgroundDrawable( getResources().getDrawable(R.drawable.buttonline_nonselected_407x9)); membersButtonLight.setBackgroundDrawable( getResources().getDrawable(R.drawable.buttonline_nonselected_407x9)); newsButtonLight.setBackgroundDrawable( getResources().getDrawable(R.drawable.buttonline_selected_407x9)); membersSelected = false; eventsSelected = false; newsSelected = true; fragmentTransaction.commit(); listAllAmbassadorsOfHubService(); }
public SelectSubwayDialog(Context context) { super(context, R.style.FullscreenDialogTheme); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.train_select_dialog); Typeface font = Typeface.createFromAsset(context.getAssets(), "fonts/VarelaRound-Regular.ttf"); Typeface font2 = Typeface.createFromAsset(context.getAssets(), "fonts/DINEngschrift-Regular.ttf"); saveButton = (Button) findViewById(R.id.save_button); saveButton.setTypeface(font2); cancelButton = (Button) findViewById(R.id.cancel_button); cancelButton.setTypeface(font2); dialogText = (TextView) findViewById(R.id.other_lines_text); dialogText.setTypeface(font); subwayLinesHolder = (LinearLayout) findViewById(R.id.subway_lines_holder); cancelButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { cancel(); } }); Resources res = context.getResources(); String[] trainLines = res.getStringArray(R.array.trains_array); for (int i = 0; i < trainLines.length; i++) { final SelectSubwayButton tlb = (SelectSubwayButton) findViewById(lineIdArray[i]); lineButtonArray.add(tlb); tlb.setImages(lineImageArray[i], lineImageSelectedArray[i], trainLines[i]); tlb.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { SelectSubwayButton tb = (SelectSubwayButton) v; if (tb.selected) { tb.setDeSelected(); checkedLinesArray.remove(tb.id); } else { tb.setSelected(); checkedLinesArray.add(tb.id); } } }); } }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.list_fragment, container, false); if (dbHelper == null) { dbHelper = DBHelper.getInstance(getActivity()); } gridView = (GridView) view.findViewById(R.id.grid_view); gridView.setOnItemClickListener(onClickListener); // gridView.setFastScrollEnabled(true); // gridView.setFastScrollAlwaysVisible(true); gridView.setAdapter(adapter); hiddenCreateView = (CreateView) view.findViewById(R.id.create_alliance); hiddenCreateView.setVisibility(View.GONE); hiddenCreateView.setElevation(16); Button button = (Button) hiddenCreateView.findViewById(R.id.list_create); button.setTypeface(DemoActivity.getFont()); new LoadCursors().execute(""); return view; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_game); Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/PoiretOne-Regular.ttf"); TextView titleTextView = (TextView) findViewById(R.id.new_game_title); titleTextView.setTypeface(typeface); final ImageView leftImage = (ImageView) findViewById(R.id.select_left_image_view); final ImageView rightImage = (ImageView) findViewById(R.id.select_right_image_view); leftImage.setPadding(1, 1, 1, 1); rightImage.setPadding(1, 1, 1, 1); leftSelected = true; leftImage.setBackgroundColor(getResources().getColor(R.color.red)); rightImage.setBackgroundColor(getResources().getColor(R.color.transparent)); leftImage.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { leftSelected = true; leftImage.setBackgroundColor(getResources().getColor(R.color.red)); rightImage.setBackgroundColor(getResources().getColor(R.color.transparent)); } }); rightImage.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { leftSelected = false; leftImage.setBackgroundColor(getResources().getColor(R.color.transparent)); rightImage.setBackgroundColor(getResources().getColor(R.color.blue)); } }); Button startButton = (Button) findViewById(R.id.finishButton); startButton.setTypeface(typeface); startButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences sharedPref = getSharedPreferences(Constants.SHARED_PREFERENCE, MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString(getString(R.string.self_instance_id), leftSelected ? "Tom" : "Jerry"); editor.putString(getString(R.string.self_base_instance_id), leftSelected ? "X" : "Y"); editor.putString( getString(R.string.opponent_instance_id), leftSelected ? "Jerry" : "Tom"); editor.putString( getString(R.string.opponent_base_instance_id), leftSelected ? "Y" : "X"); editor.commit(); setResult(RESULT_OK); finish(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); levelText = (TextView) findViewById(R.id.levelText); b1 = (ImageButton) findViewById(R.id.b1); b2 = (ImageButton) findViewById(R.id.b2); b3 = (ImageButton) findViewById(R.id.b3); b4 = (ImageButton) findViewById(R.id.b4); startButton = (Button) findViewById(R.id.startButton); b1.setOnTouchListener(this); b2.setOnTouchListener(this); b3.setOnTouchListener(this); b4.setOnTouchListener(this); startButton.setOnTouchListener(this); buttonPlayer = new FXPlayer(); flashButton = AnimationUtils.loadAnimation(this, R.anim.bflash); topTen = new TopScores(); // String[][] winners = topTen.updatedWinners(); String fontPath = "fonts/spincycle_ot.ttf"; Typeface tf = Typeface.createFromAsset(getAssets(), fontPath); levelText.setTypeface(tf); startButton.setTypeface(tf); game = new GamePlay(); updateLevel(); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle arguments = getArguments(); if (arguments != null) { mUri = arguments.getParcelable(DetailFragment.DETAIL_URI); } mll = (LinearLayout) inflater.inflate(R.layout.fragment_detail_wide, container, false); mTitle = (TextView) mll.findViewById(R.id.detail_title); mImageView = (ImageView) mll.findViewById(R.id.detail_view); mDate = (TextView) mll.findViewById(R.id.detail_date); mVote = (TextView) mll.findViewById(R.id.detail_vote); mPlot = (TextView) mll.findViewById(R.id.detail_plot); mButtonFavorite = (Button) mll.findViewById(R.id.detail_button_favorite); mTrailersll = (LinearLayout) mll.findViewById(R.id.detail_trailers_ll); mReviewsll = (LinearLayout) mll.findViewById(R.id.detail_reviews_ll); mFont = Typeface.createFromAsset(getActivity().getAssets(), "fontawesome-webfont.ttf"); mButtonFavorite.setTypeface(mFont); mButtonFavorite.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { favoriteStar(); } }); return mll; }
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { // An item was selected. You can retrieve the selected item using // parent.getItemAtPosition(pos) mFontIndex = parent.getSelectedItemPosition(); mButton.setTypeface(Utilities.getTypefaceFromIndex(mFontIndex)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_forget_password); iv_logo = (ImageView) this.findViewById(R.id.iv_logo); img_background = (ImageView) this.findViewById(R.id.img_background); resizeLogo(); fontManager = FontManager.getInstance(getAssets()); ed_email = (EditText) this.findViewById(R.id.ed_email); ed_email .getBackground() .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP); ed_new_password = (EditText) this.findViewById(R.id.ed_new_password); ed_new_password .getBackground() .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP); ed_repassword = (EditText) this.findViewById(R.id.ed_repassword); ed_repassword .getBackground() .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP); ed_email.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT)); ed_new_password.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT)); ed_repassword.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT)); btn_update_password = (Button) this.findViewById(R.id.btn_update_password); btn_update_password = (Button) this.findViewById(R.id.btn_update_password); btn_update_password.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String email = ed_email.getText().toString().trim(); String password = ed_new_password.getText().toString(); String repassword = ed_repassword.getText().toString(); if (verifyInputs(email, password, repassword)) { v.startAnimation(animFade); update_password(email, password); } } }); btn_update_password.setTypeface(fontManager.getFont(FontManager.ROBOTO_MEDIUM)); iv_back = (ImageView) this.findViewById(R.id.iv_back); iv_back.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); ll_parent = (CoordinatorLayout) this.findViewById(R.id.ll_parent); ll_parent.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { hideSoftKeyboard(); } }); mValidator = Validator.getInstance(); animFade = AnimationUtils.loadAnimation(ForgetPassword.this, R.anim.fade); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); PRIMETIME = Typeface.createFromAsset(getAssets(), "primetime.ttf"); NEOMETRIC = Typeface.createFromAsset(getAssets(), "neoteric.ttf"); Button polaczButton = (Button) findViewById(R.id.buttonBTConnect); Button ustawieniaButton = (Button) findViewById(R.id.buttonUstawienia); Button sterowanieButton = (Button) findViewById(R.id.buttonSterowanie); polaczButton.setTypeface(PRIMETIME); ustawieniaButton.setTypeface(PRIMETIME); sterowanieButton.setTypeface(PRIMETIME); }
private void fillUI() { // add logic in order not to set twice values, loader get's called twice. Picasso.with(getContext()).load(mMovie.getPosterUri()).into(mImageView); mTitle.setText(mMovie.getTitle()); mDate.setText(mMovie.getReleaseDate().trim().substring(0, 4)); if (mMovie.getVoteAverage() != null) mVote.setText(String.valueOf(mMovie.getVoteAverage()) + "/10"); mPlot.setText(mMovie.getOverview()); if (!(mReviews == null || mReviews.isEmpty())) { for (Reviews.Result review : mReviews) { TextView textView = new TextView(getContext()); textView.setLayoutParams( new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); textView.setText( getResources().getString(R.string.icon_video) + "\n" + review.getContent()); textView.setTypeface(mFont); textView.setPadding(2, 2, 2, 2); // textView.setTextAppearance(R.s); mReviewsll.addView(textView); } } if (!(mVideos == null || mVideos.isEmpty())) { for (final Videos.Result video : mVideos) { Button button = new Button(getActivity()); button.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); button.setText(getResources().getString(R.string.icon_youtube)); button.setTypeface(mFont); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (mVideos != null) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(video.getUri()))); } } }); button.setPadding(2, 2, 2, 2); mTrailersll.addView(button); } } Log.d(LOG_TAG, getActivity().getLocalClassName().trim()); if (getActivity().getLocalClassName().equalsIgnoreCase("DetailActivity")) { Log.d(LOG_TAG, "insidePhone"); Resources r = getResources(); float width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 185, r.getDisplayMetrics()); float height = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 262, r.getDisplayMetrics()); mImageView.setLayoutParams( new LinearLayout.LayoutParams(new ViewGroup.LayoutParams((int) width, (int) height))); } }
public HookUpGroupPasswordDialog(final Activity activity) { super(activity, R.style.Theme_Transparent); mActivity = activity; setContentView(R.layout.group_password_dialog); mEtGroupPassword = (EditText) findViewById(R.id.etGroupPassword); mEtGroupPassword.setTypeface(SpikaApp.getTfMyriadPro()); mBtnOk = (Button) findViewById(R.id.btnOk); mBtnOk.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); mBtnOk.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String passwordsResult = checkPasswords(); if (passwordsResult.equals(PASSWORD_SUCCESS)) { if (activity instanceof GroupProfileActivity) { if (mIsSubscribe) { ((GroupProfileActivity) activity).addToFavoritesAsync(mGroupId); } else { ((GroupProfileActivity) activity).redirect(); } HookUpGroupPasswordDialog.this.dismiss(); } } else { Toast.makeText(activity, passwordsResult, Toast.LENGTH_SHORT).show(); } } }); mBtnCancel = (Button) this.findViewById(R.id.btnCancel); mBtnCancel.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); mBtnCancel.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { HookUpGroupPasswordDialog.this.dismiss(); } }); }
public void initViews() { btnClockIn = (Button) findViewById(R.id.btnClockIn); btnClockOut = (Button) findViewById(R.id.btnClockOut); btnListAll = (Button) findViewById(R.id.btnList); btnSettings = (Button) findViewById(R.id.btnSettings); btnExport = (Button) findViewById(R.id.btnExport); btnInfo = (Button) findViewById(R.id.btnInfo); btnCabinet = (Button) findViewById(R.id.btnProjects); abel = (Typeface.createFromAsset(getAssets(), "fonts/abel_regular.ttf")); btnClockIn.setTypeface(abel); btnClockOut.setTypeface(abel); btnListAll.setTypeface(abel); btnSettings.setTypeface(abel); btnExport.setTypeface(abel); btnInfo.setTypeface(abel); btnCabinet.setTypeface(abel); btnClockIn.setOnClickListener(this); btnClockOut.setOnClickListener(this); btnClockOut.setVisibility(View.GONE); btnListAll.setOnClickListener(this); btnSettings.setOnClickListener(this); btnExport.setOnClickListener(this); btnInfo.setOnClickListener(this); btnCabinet.setOnClickListener(this); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.forgot_password); // getting url from resources urlResetPassword = getResources().getString(R.string.urlResetPassword); urlGetTestQuestion = getResources().getString(R.string.urlGetTestQuestion); // Edit Text txtTestQuestion = (TextView) findViewById(R.id.resetPassTestQuestion); txtTestAnswer = (EditText) findViewById(R.id.resetPassTestAnswer); btnResetPassword = (Button) findViewById(R.id.btnResetPassword); // setting the font type from assets typeFace = Typeface.createFromAsset(getAssets(), "fonts/KELMSCOT.ttf"); txtTestQuestion.setTypeface(typeFace); txtTestAnswer.setTypeface(typeFace); btnResetPassword.setTypeface(typeFace); ((TextView) findViewById(R.id.pref1)).setTypeface(typeFace); ((TextView) findViewById(R.id.pref2)).setTypeface(typeFace); // getting userName from intent Intent intent = getIntent(); // getting data past from intent userName = intent.getStringExtra("userName"); // loading the test question new LoadTestQuestion().execute(); // button click event btnResetPassword.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { // log.d(" inside create account=", "inside onclick"); testAnswer = txtTestAnswer.getText().toString(); String msg = ""; boolean incomplete = false; if (testAnswer.matches("")) { msg = getString(R.string.pEnterTestQAns); incomplete = true; } else { new ResetPassword().execute(); } if (incomplete) Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show(); } }); }
// ��ʼ��������ť private void initCreateComponent() { Button btnCreate = (Button) mView.findViewById(R.id.btnHomeCreate); btnCreate.setTypeface(StringUtil.getTypeFaceByRegular(getActivity())); btnCreate.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { View layout = mInflater.inflate(R.layout.custom_dialog_creat_event, null, false); final Dialog dialog = new Dialog(getActivity(), R.style.dialog); dialog.setContentView(layout); dialog.setCancelable(true); dialog.show(); Window win = dialog.getWindow(); win.getDecorView().setPadding(0, 0, 0, 0); WindowManager.LayoutParams lp = win.getAttributes(); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.MATCH_PARENT; win.setAttributes(lp); Button btnCancel = (Button) layout.findViewById(R.id.btnCustomDialogCreateEventCancel); btnCancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); final Bundle extras = new Bundle(); extras.putParcelable(FDDay.BUNDLE_KEY, new FDDay(Calendar.getInstance())); Button btnSocial = (Button) layout.findViewById(R.id.btnCustomDialogCreateEventSocialEvent); btnSocial.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent socialIntent = new Intent(getActivity(), AddSocialGo2OneActivity.class); socialIntent.putExtras(extras); startActivity(socialIntent); dialog.dismiss(); } }); Button btnPerson = (Button) layout.findViewById(R.id.btnCustomDialogCreateEventPersonal); btnPerson.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent personalIntent = new Intent(getActivity(), AddPersonGo2Activity.class); personalIntent.putExtras(extras); startActivity(personalIntent); dialog.dismiss(); } }); } }); }
public void onClick(View v) { int id = v.getId(); if (id == R.id.ToggleButtonBoldText) { if ((tb_bold).isChecked()) { textView1.setTypeface(typefaceBold); textView2.setTypeface(typefaceBold); brtn1.setTypeface(typefaceBold); btn_textSize.setTypeface(typefaceBold); btn_textBold.setTypeface(typefaceBold); Button01.setTypeface(typefaceBold); Editor editor = mSettings.edit(); editor.putBoolean(APP_PREFERENCES_bold_text, true); editor.apply(); } else { textView1.setTypeface(typefaceRoman); textView2.setTypeface(typefaceRoman); brtn1.setTypeface(typefaceRoman); btn_textSize.setTypeface(typefaceRoman); btn_textBold.setTypeface(typefaceRoman); Button01.setTypeface(typefaceRoman); Editor editor = mSettings.edit(); editor.putBoolean(APP_PREFERENCES_bold_text, false); editor.apply(); } } else if (id == R.id.brtntoggle) { if ((tb_brtns).isChecked()) { Settings.System.putInt( getContentResolver(), SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_AUTOMATIC); refreshBrightness(-1); } else { Settings.System.putInt( getContentResolver(), SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_MANUAL); refreshBrightness(-1); } } else if (id == R.id.Button04) { Intent settingsIntent = new Intent(android.provider.Settings.ACTION_DISPLAY_SETTINGS); startActivity(settingsIntent); overridePendingTransition(center_to_left, center_to_left2); } else if (id == R.id.ButtonTextSize) { Intent intent18 = new Intent(this, ActivityTextSize.class); startActivity(intent18); overridePendingTransition(center_to_right, center_to_right2); } else if (id == R.id.Button01) { speed_anim(); } }
public void setFonts() { Typeface fontLogo = Typeface.createFromAsset(getAssets(), "HouseSlant-Regular.otf"); Typeface fontOthers = Typeface.createFromAsset(getAssets(), "Montserrat-Regular.ttf"); Button button = (Button) findViewById(R.id.button_play); TextView appLogoName = (TextView) findViewById(R.id.app_name); TextView headline = (TextView) findViewById(R.id.headline); button.setTypeface(fontOthers); appLogoName.setTypeface(fontLogo); headline.setTypeface(fontOthers); }