This file contains 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 initLayout(View view) { | |
mRecycler = (RecyclerView) view.findViewById(R.id.hone_gallery_recycler); | |
mRecycler.addItemDecoration(makeDivider(OrientationHelper.VERTICAL)); | |
mRecycler.addItemDecoration(makeDivider(OrientationHelper.HORIZONTAL)); | |
} | |
private DividerItemDecoration makeDivider(int orientation) { | |
DividerItemDecoration divider = new DividerItemDecoration(getActivity(), orientation); | |
divider.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.hone_gallery_divider)); |
This file contains 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
// http://stackoverflow.com/questions/601503/how-do-i-obtain-crash-data-from-my-android-application | |
// 단 android 23 이상이면 runtime permission 이 등록이 되어 있어야 한다. | |
private void testForceCrash() { | |
throw new RuntimeException("This is a crash"); | |
} | |
public void testCrashListener() { | |
if(!(Thread.getDefaultUncaughtExceptionHandler() instanceof CustomExceptionHandler)) { | |
Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler( |
This file contains 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
<#if !(perModuleRepositories??) || perModuleRepositories> | |
buildscript { | |
repositories { | |
jcenter() | |
<#if mavenUrl != "mavenCentral"> | |
maven { | |
url '${mavenUrl}' | |
} | |
</#if> | |
} |
This file contains 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
/** | |
* 바코드 정보를 담고 있는 이미지의 uri 정보를 기준으로 디코딩 하여 결과를 얻는다 | |
* @param intent 바코드 파일의 경로 정보를 담고 있는 intent | |
* @return 디코드 된 바코드 정보 | |
*/ | |
private Result dataFromPath(Intent intent) { | |
int width; | |
int height; | |
int pixels[]; |
This file contains 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
// http://stackoverflow.com/questions/10895882/mute-the-global-sound-in-android | |
// mute audio | |
AudioManager manager=(AudioManager)getSystemService(Context.AUDIO_SERVICE); | |
manager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true); | |
manager.setStreamMute(AudioManager.STREAM_ALARM, true); | |
manager.setStreamMute(AudioManager.STREAM_MUSIC, true); | |
manager.setStreamMute(AudioManager.STREAM_RING, true); | |
manager.setStreamMute(AudioManager.STREAM_SYSTEM, true); | |
// unmute audio |
This file contains 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 Example extends Fragment { | |
@Override | |
public View onCreateView(LayoutInflator inflater, ViewGroup container, Bundle saveInstanceState) { | |
View view = inflater.inflate(R.layout.your_layout_id, container, false); | |
TextView view = (TextView) view.findViewById(R.id.your_id); | |
return view; | |
} | |
} |
This file contains 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
/* | |
* Copyright (C) 2014 NextApp, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" | |
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language |
This file contains 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
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.mainLayout); | |
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( | |
FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT); | |
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL; | |
Button centerBtn = new Button(getBaseContext()); | |
centerBtn.setText("CENTER BUTTON"); | |
centerBtn.setLayoutParams(lp); |
This file contains 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
String connNetwork; | |
ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo manager.getActiveNetworkInfo(); | |
if (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE && info.isConnected()) { | |
TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | |
connNetwork = "3G"; | |
if (telManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_LTE) { | |
connNetwork += "/4G"; |
This file contains 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
// http://stackoverflow.com/questions/8229150/android-save-contact-image-programmatically | |
ArrayList<ContentProviderOperation> ops = | |
new ArrayList<ContentProviderOperation>(); | |
... | |
int rawContactInsertIndex = ops.size(); | |
// intial setup | |
ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI) | |
.withValue(RawContacts.ACCOUNT_TYPE, accountType) | |
.withValue(RawContacts.ACCOUNT_NAME, accountName) |