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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
Uri uri = getIntent().getData(); | |
if (uri != null) { | |
copyTextToClipboard(uri.toString()); | |
Toast.makeText(this, R.string.link_copied_to_clipboard, Toast.LENGTH_SHORT).show(); | |
} |
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
<activity | |
android:name=".CopyToClipboardActivity" | |
android:exported="false" | |
android:icon="@mipmap/ic_copy_link" | |
android:label="@string/copy_link_to_clipboard" | |
android:theme="@android:style/Theme.NoDisplay"> | |
</activity> |
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 void loadShortUrl(String url, final ShortUrlCallBack callBack) { | |
Call<ShortUrlResult> call = mNaverService.getShortUrl(url); | |
call.enqueue(new Callback<ShortUrlResult>() { | |
@Override | |
public void onResponse(Call<ShortUrlResult> call, Response<ShortUrlResult> response) { | |
if (callBack != null) { | |
if (response.body() != null) { | |
callBack.onShortUrlSuccess(response.body().getResult()); | |
} else { | |
callBack.onShortUrlFail(); |
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 ShortUrlResult{ | |
String message; | |
String code; | |
ShortUrlData result; | |
public ShortUrlData getResult() { | |
return result; | |
} |
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
@Override | |
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position, @NonNull List<Object> payloads) { | |
if (payloads.isEmpty()) { | |
super.onBindViewHolder(holder, position, payloads); | |
} else { | |
for (Object payload : payloads) { | |
if (payload instanceof String) { | |
String type = (String) payload; | |
if (holder instanceof TextHolder) { | |
TextHolder textHolder = (TextHolder) holder; |
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
findViewById(R.id.last_item_favorite_button).setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
//refresh last item | |
adapter.notifyItemChanged(adapter.getItemCount() - 1, "click1"); | |
adapter.notifyItemChanged(adapter.getItemCount() - 1, "click2"); | |
adapter.notifyItemChanged(adapter.getItemCount() - 1, "click3"); | |
} | |
}); | |
findViewById(R.id.all_item_favorite_button).setOnClickListener(new View.OnClickListener() { |
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
@Override | |
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | |
TextHolder textHolder = (TextHolder) holder; | |
textHolder.mTextView.setText(items.get(position)); | |
} | |
@Override | |
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position, @NonNull List<Object> payloads) { | |
if (payloads.isEmpty()) { | |
super.onBindViewHolder(holder, position, payloads); |
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
RecyclerView recyclerView = findViewById(R.id.recyclerview); | |
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); | |
recyclerView.setLayoutManager(linearLayoutManager); | |
recyclerView.setItemAnimator(null); | |
final ArrayList<String> items = new ArrayList<>(); | |
items.add("hello~ item1"); | |
items.add("hello~ item2"); | |
items.add("hello~ item3"); | |
final RecyclerAdapter adapter = new RecyclerAdapter(items); |
NewerOlder