@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void excludeItemsFromTransitionIfLollipop() { Slide transition = new Slide(); transition.excludeTarget(android.R.id.statusBarBackground, true); transition.excludeTarget(R.id.toolbar, true); getWindow().setEnterTransition(transition); getWindow().setReturnTransition(transition); }
public static ArticleDetailFragment newInstance(long itemId, Context context) { Bundle arguments = new Bundle(); arguments.putLong(ARG_ITEM_ID, itemId); ArticleDetailFragment fragment = new ArticleDetailFragment(); fragment.setArguments(arguments); Slide slide = new Slide(Gravity.BOTTOM); slide.addTarget(R.id.cvContent); slide.setInterpolator( AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in)); slide.setDuration(500); fragment.setEnterTransition(slide); return fragment; }
@Override protected void onCreate(Bundle savedInstanceState) { remplaceFont.replaceDefaultFont(this, "DEFAULT", "Exo-Medium.otf"); remplaceFont.replaceDefaultFont(this, "SANS", "Roboto-Light.ttf"); remplaceFont.replaceDefaultFont(this, "SERIF", "Roboto-Light.ttf"); super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(this); setContentView(R.layout.activity_inscription); firstName = (TextInputLayout) findViewById(R.id.layoutFirstName); lastName = (TextInputLayout) findViewById(R.id.layoutLastName); email = (TextInputLayout) findViewById(R.id.layoutEmail); emailConfirmed = (TextInputLayout) findViewById(R.id.layoutEmailConfirmed); password = (TextInputLayout) findViewById(R.id.layoutPassword); passwordConfirmed = (TextInputLayout) findViewById(R.id.layoutPasswordConfirmed); inscrptionButton = (ImageView) findViewById(R.id.inscrptionButton); progressBar = (ProgressBar) findViewById(R.id.ProgressBar); imageSuccess = (ImageView) findViewById(R.id.yes); imageEchec = (ImageView) findViewById(R.id.no); progressBar.setVisibility(View.GONE); imageSuccess.setVisibility(View.GONE); imageEchec.setVisibility(View.GONE); Retrofit retrofit = new Retrofit.Builder().baseUrl(GitHubService.baseUrl).build(); gitHubService = retrofit.create(GitHubService.class); if (Build.VERSION.SDK_INT >= 21) { Slide slide = new Slide(); slide.setDuration(400); getWindow().setEnterTransition(slide); getWindow() .setReturnTransition( TransitionInflater.from(this).inflateTransition(R.transition.shared_element_a)); } inscrptionButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String firstNameValue = firstName.getEditText().getText().toString(); String lastNameValue = lastName.getEditText().getText().toString(); String emailValue = email.getEditText().getText().toString(); String emailConfirmedValue = emailConfirmed.getEditText().getText().toString(); String passwordValue = password.getEditText().getText().toString(); String passwordConfirmedValue = passwordConfirmed.getEditText().getText().toString(); firstName.setErrorEnabled(false); firstName.requestFocus(); lastName.setErrorEnabled(false); lastName.requestFocus(); email.setErrorEnabled(false); email.requestFocus(); emailConfirmed.setErrorEnabled(false); emailConfirmed.requestFocus(); password.setErrorEnabled(false); password.requestFocus(); passwordConfirmed.setErrorEnabled(false); passwordConfirmed.requestFocus(); if (!validateInput(firstNameValue)) { firstName.setError("nom non valide !"); firstName.requestFocus(); // hideButton(); mdperreur(); } else if (!validateInput(lastNameValue)) { lastName.setError("prénom non valide !"); lastName.requestFocus(); mdperreur(); } else if (!validateEmail(emailValue)) { email.setError("Email non valide !"); email.requestFocus(); // hideButton(); mdperreur(); } else if (!validateEmail(emailConfirmedValue)) { emailConfirmed.setError("Email non valide !"); emailConfirmed.requestFocus(); // hideButton(); mdperreur(); } else if (!(emailValue.equals(emailConfirmedValue))) { email.setError("Les deux e-mails ne sont pas identiques"); emailConfirmed.setError("Les deux e-mails ne sont pas identiques"); emailConfirmed.requestFocus(); // hideButton(); mdperreur(); } else if (!validatePassword(passwordValue)) { password.setError("Mot de passe non valide !"); password.requestFocus(); // hideButton(); mdperreur(); } else if (!validateInput(passwordConfirmedValue)) { passwordConfirmed.setError("Mot de passe non valide !"); passwordConfirmed.requestFocus(); // hideButton(); mdperreur(); } else if (!(passwordValue.equals(passwordConfirmedValue))) { password.setError("Les deux mots de passe ne sont pas identiques"); passwordConfirmed.setError("Les deux mots de passe ne sont pas identiques"); passwordConfirmed.requestFocus(); // hideButton(); mdperreur(); } else { hideKeyboard(); doInscri(firstNameValue, lastNameValue, emailValue, passwordValue); } } }); // facebook login callbackManager = CallbackManager.Factory.create(); loginFacebook = (LoginButton) findViewById(R.id.login_button); loginManager = LoginManager.getInstance(); loginFacebook.setReadPermissions(readPermissions); loginFacebook.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { hideButton(); } }); loginFacebook.registerCallback( callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { accessToken = AccessToken.getCurrentAccessToken(); // Log.d("user facebook",loginResult.toString()); GraphRequest request = GraphRequest.newMeRequest( loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() { @Override public void onCompleted(JSONObject object, GraphResponse response) { Log.v("LoginActivity", response.toString()); try { User user = new User( object.get("id").toString(), object.get("email").toString(), object.get("name").toString()); AuthUtils.saveUser(InscriptionActivity.this, user); succ(); } catch (JSONException e) { e.printStackTrace(); } } }); Bundle parameters = new Bundle(); parameters.putString("fields", "id,name,email"); request.setParameters(parameters); request.executeAsync(); } @Override public void onCancel() { Toast.makeText(getBaseContext(), "cancel", Toast.LENGTH_SHORT).show(); } @Override public void onError(FacebookException error) { Toast.makeText(getBaseContext(), "error,retry again", Toast.LENGTH_SHORT).show(); error.printStackTrace(); mdperreur(); } }); // google+ login // [START configure_signin] // Configure sign-in to request the user's ID, email address, and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build(); // [START build_client] // Build a GoogleApiClient with access to the Google Sign-In API and the // options specified by gso. mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); signInButtonGoogle = (SignInButton) findViewById(R.id.sign_in_button); signInButtonGoogle.setSize(SignInButton.SIZE_STANDARD); signInButtonGoogle.setScopes(gso.getScopeArray()); signInButtonGoogle.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { progressBar.setVisibility(View.VISIBLE); Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); startActivityForResult(signInIntent, RC_SIGN_IN); hideButton(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= 21) { Slide slide = new Slide(); slide.setDuration(1000); getWindow().setEnterTransition(slide); // TransitionInflater inflater = TransitionInflater.from(this); // Transition transition = // inflater.inflateTransition(R.transition.transtion_main_activity); // getWindow().setExitTransition(transition); } setContentView(R.layout.activity_courese_detail_); btnStart = (Button) findViewById(R.id.btnStart); cbConfirm = (CheckBox) findViewById(R.id.cbConfirm); sp = getSharedPreferences("PREF_NAME", Context.MODE_PRIVATE); editor = sp.edit(); getSharedPefference(); btnStart.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (cbConfirm.isChecked()) { ActivityOptionsCompat compat = ActivityOptionsCompat.makeSceneTransitionAnimation( CoureseDetail_Activity.this, null); startActivity( new Intent(CoureseDetail_Activity.this, QuestionPageActivity.class), compat.toBundle()); // Toast.makeText(getApplicationContext(),"CheckBox is // Checked",Toast.LENGTH_LONG).show(); } else { // Toast.makeText(getApplicationContext(),"CheckBox is // unCheck",Toast.LENGTH_LONG).show(); new AlertDialog.Builder(CoureseDetail_Activity.this) .setTitle("ກະລຸນາໝາຍຕິກ") .setMessage("ກະລຸນາຕິກເພື່ອຢືນຢັນວ່າພ້ອມສອບເສັງແລ້ວ.") .setPositiveButton( "ຕົກລົງ", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); } } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= 21) { Slide slide = new Slide(); slide.setDuration(1000); getWindow().setEnterTransition(slide); // TransitionInflater inflater = TransitionInflater.from(this); // Transition transition = // inflater.inflateTransition(R.transition.transtion_main_activity); // getWindow().setExitTransition(transition); } setContentView(R.layout.activity_question_page); txtQuestion = (TextView) findViewById(R.id.txtQuestion); txtTime = (TextView) findViewById(R.id.txtTime); txtStudentAnswer = (TextView) findViewById(R.id.txtStdentAnswer); btnBackQ = (Button) findViewById(R.id.btnBackQ); btnNextQ = (Button) findViewById(R.id.btnNextQ); btnSubmit = (Button) findViewById(R.id.btnSubmit); sp = getSharedPreferences("PREF_QUESTION", Context.MODE_PRIVATE); spName = getSharedPreferences("PREF_NAME", Context.MODE_PRIVATE); teacher_id = spName.getInt("teacher_id", -1); subject_id = spName.getInt("subject_id", -1); interval_time = spName.getInt("interval_time", -1); // interval_time = 1; question_amount = (spName.getInt("question_amount", -1) - 1); question_amount_real = spName.getInt("question_amount", -1); Log.i("GExam", "question_amount= " + (question_amount + 1)); editor = sp.edit(); editorName = spName.edit(); // int question_amount = sp.getInt("question_amount",-1); arrayQuestion = getQuestion().toArray(new String[getQuestion().size()]); // change list<String> to array for (int i = 0; i < arrayQuestion.length; i++) { Log.d("GExam", "arrayQuestion " + i + arrayQuestion[i]); } Question = arrayQuestion[counter]; Answer1 = getAnswer(Question).get(0); Answer2 = getAnswer(Question).get(1); Answer3 = getAnswer(Question).get(2); Answer4 = getAnswer(Question).get(3); CorrectAnswer1 = getAnswer(Question).get(4); CorrectAnswer2 = getAnswer(Question).get(5); CorrectAnswer3 = getAnswer(Question).get(6); CorrectAnswer4 = getAnswer(Question).get(7); QuestionAnswer = new String[] { Answer1, Answer2, Answer3, Answer4, Question, CorrectAnswer1, CorrectAnswer2, CorrectAnswer3, CorrectAnswer4 }; // AnswerOnly = new String[]{CorrectAnswer1, CorrectAnswer2, CorrectAnswer3, // CorrectAnswer4}; QuestionID = getQuestionID(Question); AnswerOnly = getCorrectAnswer(Question); specificQuestion = AnswerOnly[0]; specificAnswer = AnswerOnly[1]; specificCorrectAnswer = AnswerOnly[2]; Log.d("GExam", "QuestionID= " + QuestionID); txtQuestion.setText(counter + 1 + "/" + (question_amount + 1) + " " + Question); editor.putInt("Question_ID " + counter, QuestionID); // Log.d("counter", "counter = " + counter+ "question = " + Question); addRadioButton(QuestionAnswer.length - 5, QuestionAnswer); CountDown(); btnSubmit.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { final AlertDialog.Builder builder1 = new AlertDialog.Builder(QuestionPageActivity.this); builder1.setTitle("Finish?"); builder1.setMessage("ທ່ານຕ້ອງການສົ່ງຂໍ້ສອບແທ້ບໍ?"); builder1.setCancelable(false); builder1.setPositiveButton( "ສົ່ງຂໍ້ສອບ", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { new SimpleTask().execute(); } }); builder1.setNegativeButton( "ປະຕິເສດ", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alert11 = builder1.create(); alert11.show(); } }); btnBackQ.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { counter--; txtStudentAnswer.setText(""); if (counter < 0) { counter = question_amount; QuestionAnswerPerPage(counter); } else { Log.d("counter", "counter = " + counter + "question = " + Question); QuestionAnswerPerPage(counter); } int answer = sp.getInt("answer_choice " + (counter), -1); if (answer != -1) { ((RadioButton) rgp.getChildAt(answer)).setChecked(true); } } }); btnNextQ.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { counter++; txtStudentAnswer.setText(""); if (counter <= question_amount) { QuestionAnswerPerPage(counter); } else { counter = 0; Log.d("counter", "counter = " + counter + "question = " + Question); QuestionAnswerPerPage(counter); } answer = sp.getInt("answer_choice " + (counter), -1); // if (rgp.getCheckedRadioButtonId() != -1) { // // rgp.clearCheck(); // // // } if (answer != -1) { ((RadioButton) rgp.getChildAt(answer)).setChecked(true); } } }); }