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 static void showHashKey(Context context) { | |
try { | |
PackageInfo info = context.getPackageManager().getPackageInfo( | |
"com.example.yourpackagename", PackageManager.GET_SIGNATURES); //Your package name here | |
for (Signature signature : info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
Log.i("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); | |
} | |
} catch (NameNotFoundException e) { |
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 BaseActivity extends Activity implements OnConnectivityChangedListener { | |
private ConnectivityChangeReceiver connectivityChangeReceiver; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
connectivityChangeReceiver = new ConnectivityChangeReceiver(this); | |
IntentFilter filter = new IntentFilter(); | |
filter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); | |
registerReceiver(connectivityChangeReceiver, filter); |
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
Make button move up when softkeyboard is shown | |
<activity android:windowSoftInputMode="adjustPan"> </activity> | |
Put next or done on SoftKeyboard | |
android:imeOptions="actionNext" | |
android:imeOptions="actionSend" | |
Empty states in Android, best practices | |
https://www.reddit.com/r/androiddev/comments/3bjnxi/best_way_to_handle_recyclerview_empty_state/https://www.reddit.com/r/androiddev/comments/3bjnxi/best_way_to_handle_recyclerview_empty_state/ |
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
itemTitle.requestFocus(); | |
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); | |
imm.showSoftInput(itemTitle, InputMethodManager.SHOW_IMPLICIT); |
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
Picasso.with(context) | |
.load(item.getFrontImage()) | |
.into(itemFrontImage); |
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
//Based on the link: Why doesn't RecyclerView have onItemClickListener()? and How RecyclerView is different from Listview?, and also @Duncan's general idea, I give my solution here: | |
//define one interface 'RecyclerViewClickListener' for passing message from adapter to Activity/Fragment: | |
public interface RecyclerViewClickListener | |
{ | |
public void recyclerViewListClicked(View v, int position); | |
} | |
//In Activity/Fragment implement the interface, and also pass listener to adapter: | |
@Override |
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
package isabelle.com.requestpermissiondemo; | |
import android.Manifest; | |
import android.annotation.TargetApi; | |
import android.content.DialogInterface; | |
import android.content.pm.PackageManager; | |
import android.os.Build; | |
import android.support.v7.app.AlertDialog; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; |
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
package com.google.firebase.zerotoapp; | |
public class ChatMessage { | |
public String name; | |
public String message; | |
public ChatMessage() { | |
} | |
public ChatMessage(String name, String message) { |
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
package com.yatoo.adapter.recyclerView; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.ViewGroup; | |
/** | |
* Created by student5303 on 4/04/16. | |
*/ | |
public abstract class ClickableRecyclerViewAdapter<VH extends com.yatoo.adapter.recyclerView.ClickableViewHolder> extends RecyclerView.Adapter implements com.yatoo.adapter.recyclerView.ClickableViewHolder.ClickableViewHolderListener { |
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
package com.yatoo.activity; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v7.widget.GridLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.LinearLayout; |
OlderNewer