Skip to content

Instantly share code, notes, and snippets.

View rasoulmiri's full-sized avatar
😊

Rasoul Miri rasoulmiri

😊
  • Sweden
  • 03:17 (UTC +02:00)
View GitHub Profile
@rasoulmiri
rasoulmiri / timer2
Created September 18, 2017 18:35
timer2
//after 7 second photo load in imageView
//timer for show phoyo
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
header.setImageResource(R.drawable.header_watches);
progressBar.setVisibility(View.GONE);
}
}, 7000);
@rasoulmiri
rasoulmiri / timer
Created September 18, 2017 18:33
timer
//after 7 second photo load in imageView
//timer for show phoyo
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
header.setImageResource(R.drawable.header_watches);
}
}, 7000);
@rasoulmiri
rasoulmiri / style.xml (Flavor finalByWindowBackgroundColor)
Last active September 18, 2017 18:24
style.xml (Flavor finalByWindowBackgroundColor)
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/gray</item>
//...
</style>
</resources>
@rasoulmiri
rasoulmiri / style.xml (Flavor finalByWindowBackgroundNull)
Last active September 18, 2017 18:23
style.xml (Flavor finalByWindowBackgroundNull)
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@null</item>
//...
</style>
</resources>
@rasoulmiri
rasoulmiri / style.xml (Flavor initial)
Last active September 18, 2017 18:21
style.xml (Flavor initial)
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
//...
</style>
</resources>
@rasoulmiri
rasoulmiri / watch_card.xml
Created September 18, 2017 18:13
watch_card.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="8dp"
@rasoulmiri
rasoulmiri / WatchAdapter.java
Created September 18, 2017 18:12
WatchAdapter.java
class WatchAdapter extends RecyclerView.Adapter<WatchAdapter.MyViewHolder> {
private Context context;
private List<Watch> watchList;
class MyViewHolder extends RecyclerView.ViewHolder {
TextView brand, color;
ImageView thumbnail;
MyViewHolder(View view) {
super(view);
@rasoulmiri
rasoulmiri / activity_main.xml
Last active September 18, 2017 18:09
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray"
android:descendantFocusability="beforeDescendants"
android:fitsSystemWindows="true"
android:focusableInTouchMode="true">
@rasoulmiri
rasoulmiri / MainActivity.java
Created September 18, 2017 18:02
MainActivity
public class MainActivity extends AppCompatActivity {
private RecyclerView recyclerView;
ProgressBar progressBar;
ImageView header;
private WatchAdapter adapter;
private List<Watch> watchList;
private int[] thumbnails = new int[]{R.drawable.watch_1, R.drawable.watch_2, R.drawable.watch_3, R.drawable.watch_4};
private String[] brands = new String[]{"Nike Sport Band","Nike Sport Band","Nike Sport Band","Nike Sport Band"};