This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun getHashKey(){ | |
| val info: PackageInfo | |
| try { | |
| info = packageManager.getPackageInfo("com.example.a2ndaccidentprevention", PackageManager.GET_SIGNATURES) | |
| for (signature in info.signatures) { | |
| var md: MessageDigest | |
| md = MessageDigest.getInstance("SHA") | |
| md.update(signature.toByteArray()) | |
| val something: String = String(Base64.encode(md.digest(), 0)) | |
| //String something = new String(Base64.encodeBytes(md.digest())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define('API_ACCESS_KEY','your_firebase_server_key'); | |
| $fcmUrl = 'https://fcm.googleapis.com/fcm/send'; | |
| $token='target_user's_token'; | |
| $notification = [ | |
| 'title' =>'title', | |
| 'body' => 'body of message.', | |
| 'icon' =>'myIcon', | |
| 'sound' => 'mySound' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ChildAdapter extends RecyclerView.Adapter<ChildAdapter.ItemViewHolder>{ | |
| private AdapterListener listener; | |
| private CalculatorEditDialog dialog; | |
| private long parent_id; | |
| private List<String> dateList= new ArrayList<>(); | |
| private List<Long> id= new ArrayList<>(); | |
| private List<NoteContract> noteList; | |
| private DateContract data; | |
| private String date; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.health.myapplication.alarm; | |
| import android.app.NotificationChannel; | |
| import android.app.NotificationManager; | |
| import android.app.PendingIntent; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.graphics.Color; | |
| import android.os.Build; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void uploadPost(){ | |
| progressON(); | |
| final String text = textInputEditText.getText().toString(); | |
| final Long time = System.currentTimeMillis(); | |
| final String filename = user.getUid()+"_"+time; | |
| StorageReference storageRef = storage.getReference(); | |
| final StorageReference ImagesRef = storageRef.child("posts/"+filename+".jpg"); | |
| imageView.setDrawingCacheEnabled(true); | |
| imageView.buildDrawingCache(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class RecyclerViewAdapter_post extends RecyclerView.Adapter<RecyclerViewAdapter_post.ItemViewHolder> { | |
| private Activity activity; | |
| private RecyclerView recyclerView; | |
| private PostScrollToPositionListener postScrollToPositionListener; //to notify item change, so parent should know | |
| private SwipeRefreshLayout refreshLayout; | |
| /** | |
| * Constructor For PostActivity | |
| */ | |
| public RecyclerViewAdapter_post(final Activity activity, FragmentManager fragmentManager, RecyclerView recyclerView, SwipeRefreshLayout refreshLayout) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void signUpRegex(final String email, final String password){ | |
| //키보드 내리기 | |
| View view = this.getCurrentFocus(); | |
| if (view != null) { | |
| InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); | |
| imm.hideSoftInputFromWindow(view.getWindowToken(), 0); | |
| } | |
| String pwPattern = "^(?=.*\\d)(?=.*[~`!@#$%\\^&*()-])(?=.*[a-z])(?=.*[A-Z]).{9,12}$"; | |
| Matcher matcher = Pattern.compile(pwPattern).matcher(password); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.healthtagram.fcm; | |
| public class FCMpush { | |
| private static final MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); | |
| private static final String uri = "https://fcm.googleapis.com/fcm/send"; | |
| private static final String serverKey = "AIzaSyD...."; | |
| private Gson gson; | |
| private OkHttpClient httpClient; | |
| //싱글톤 패턴을 위해 생성사를 private으로 선언 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Bitmap getCircledBitmap(Bitmap bitmap) { | |
| Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); | |
| Canvas canvas = new Canvas(output); | |
| final Paint paint = new Paint(); | |
| final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); | |
| paint.setAntiAlias(true); | |
| canvas.drawARGB(0, 0, 0, 0); | |
| canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2, bitmap.getWidth() / 2, paint); | |
| paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); |