Java Code Examples for android.widget.TextView.postDelayed()

The following are Jave code examples for showing how to use postDelayed() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: EmulatorDetect   File: MainActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    place = (TextView) findViewById(R.id.tv_placeholder);
    textView = (TextView) findViewById(R.id.tv_info);
    textView.postDelayed(new Runnable() {
        @Override
        public void run() {
            place.setVisibility(View.GONE);
            if (EmulatorDetector.getDefault().isEmulator()) {
                textView.setText("This device is emulator\n" + EmulatorDetector.getDefault().getEmulatorName());
            } else {
                textView.setText("This device is not emulator\n");
            }
        }
    }, 1000L);
}
 
Example 2
Project: GitHub   File: RxLinearActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle("Rx线性排布");
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    textView1 = (TextView) findViewById(R.id.text1);
    textView2 = (TextView) findViewById(R.id.text2);
    textView3 = (TextView) findViewById(R.id.text3);
    textView4 = (TextView) findViewById(R.id.text4);
    helper = new RxAdapterHelper();
    SimpleRxHelperAdapter adapter = new SimpleRxHelperAdapter(helper);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter));
    recyclerView.setAdapter(adapter);

    helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
    textView3.postDelayed(new Runnable() {
        @Override
        public void run() {
            Random random = new Random();
            int rand = random.nextInt(6);
            List<MultiHeaderEntity> list = new ArrayList<>();
            for (int i = 0, size = rand + 1; i < size; i++) {
                list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
            }
            textView3.setText(String.format("类型3的数量:%d", list.size()));
            helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
        }
    }, 3000);
}
 
Example 3
Project: GitHub   File: CommonLinearActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle("一般线性排布");
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    textView1 = (TextView) findViewById(R.id.text1);
    textView2 = (TextView) findViewById(R.id.text2);
    textView3 = (TextView) findViewById(R.id.text3);
    textView4 = (TextView) findViewById(R.id.text4);
    helper = new SimpleCommonHelper();
    SimpleCommonHelperAdapter adapter = new SimpleCommonHelperAdapter(helper);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);

    helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
    textView3.postDelayed(new Runnable() {
        @Override
        public void run() {
            Random random = new Random();
            int rand = random.nextInt(6);
            List<MultiHeaderEntity> list = new ArrayList<>();
            for (int i = 0, size = rand + 1; i < size; i++) {
                list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
            }
            textView3.setText(String.format("类型3的数量:%d", list.size()));
            helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
        }
    }, 3000);
}
 
Example 4
Project: GitHub   File: LinearActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle("线性排布");
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    textView1 = (TextView) findViewById(R.id.text1);
    textView2 = (TextView) findViewById(R.id.text2);
    textView3 = (TextView) findViewById(R.id.text3);
    textView4 = (TextView) findViewById(R.id.text4);
    helper = new SimpleHelper();
    SimpleHelperAdapter adapter = new SimpleHelperAdapter(helper);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter));
    recyclerView.setAdapter(adapter);

    helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
    textView3.postDelayed(new Runnable() {
        @Override
        public void run() {
            Random random = new Random();
            int rand = random.nextInt(6);
            List<MultiHeaderEntity> list = new ArrayList<>();
            for (int i = 0, size = rand + 1; i < size; i++) {
                list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
            }
            textView3.setText(String.format("类型3的数量:%d", list.size()));
            helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
        }
    }, 3000);
}
 
Example 5
Project: MultiTypeRecyclerViewAdapter   File: RxLinearActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle("Rx线性排布");
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    textView1 = (TextView) findViewById(R.id.text1);
    textView2 = (TextView) findViewById(R.id.text2);
    textView3 = (TextView) findViewById(R.id.text3);
    textView4 = (TextView) findViewById(R.id.text4);
    helper = new RxAdapterHelper();
    SimpleRxHelperAdapter adapter = new SimpleRxHelperAdapter(helper);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter));
    recyclerView.setAdapter(adapter);

    helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
    textView3.postDelayed(new Runnable() {
        @Override
        public void run() {
            Random random = new Random();
            int rand = random.nextInt(6);
            List<MultiHeaderEntity> list = new ArrayList<>();
            for (int i = 0, size = rand + 1; i < size; i++) {
                list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
            }
            textView3.setText(String.format("类型3的数量:%d", list.size()));
            helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
        }
    }, 3000);
}
 
Example 6
Project: MultiTypeRecyclerViewAdapter   File: CommonLinearActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle("一般线性排布");
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    textView1 = (TextView) findViewById(R.id.text1);
    textView2 = (TextView) findViewById(R.id.text2);
    textView3 = (TextView) findViewById(R.id.text3);
    textView4 = (TextView) findViewById(R.id.text4);
    helper = new SimpleCommonHelper();
    SimpleCommonHelperAdapter adapter = new SimpleCommonHelperAdapter(helper);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);

    helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
    textView3.postDelayed(new Runnable() {
        @Override
        public void run() {
            Random random = new Random();
            int rand = random.nextInt(6);
            List<MultiHeaderEntity> list = new ArrayList<>();
            for (int i = 0, size = rand + 1; i < size; i++) {
                list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
            }
            textView3.setText(String.format("类型3的数量:%d", list.size()));
            helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
        }
    }, 3000);
}
 
Example 7
Project: MultiTypeRecyclerViewAdapter   File: LinearActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle("线性排布");
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    textView1 = (TextView) findViewById(R.id.text1);
    textView2 = (TextView) findViewById(R.id.text2);
    textView3 = (TextView) findViewById(R.id.text3);
    textView4 = (TextView) findViewById(R.id.text4);
    helper = new SimpleHelper();
    SimpleHelperAdapter adapter = new SimpleHelperAdapter(helper);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter));
    recyclerView.setAdapter(adapter);

    helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
    textView3.postDelayed(new Runnable() {
        @Override
        public void run() {
            Random random = new Random();
            int rand = random.nextInt(6);
            List<MultiHeaderEntity> list = new ArrayList<>();
            for (int i = 0, size = rand + 1; i < size; i++) {
                list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
            }
            textView3.setText(String.format("类型3的数量:%d", list.size()));
            helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
        }
    }, 3000);
}
 
Example 8
Project: OneDrawable   File: MainActivity.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    tvIcon1 = (TextView) findViewById(R.id.tv_icon_1);
    tvIcon2 = (TextView) findViewById(R.id.tv_icon_2);
    tvIcon3 = (TextView) findViewById(R.id.tv_icon_3);
    tvIcon4 = (TextView) findViewById(R.id.tv_icon_4);

    tvColor1 = (TextView) findViewById(R.id.tv_color_1);
    tvColor2 = (TextView) findViewById(R.id.tv_color_2);
    tvColor3 = (TextView) findViewById(R.id.tv_color_3);


    Drawable icon1 = OneDrawable.createBgDrawable(this, R.drawable.ic_action_add);
    tvIcon1.setBackgroundDrawable(icon1);
    tvIcon1.setClickable(true);
    tvIcon1.setEnabled(false);

    tvIcon1.postDelayed(new Runnable() {
        @Override
        public void run() {
            tvIcon1.setEnabled(true);
        }
    }, 3000);

    Drawable icon2 = OneDrawable.createBgDrawableWithDarkMode(this, R.drawable.ic_action_add, 0.4f);
    tvIcon2.setBackgroundDrawable(icon2);
    tvIcon2.setClickable(true);

    Drawable icon3 = OneDrawable.createBgDrawableWithAlphaMode(this, R.drawable.ic_action_name);
    tvIcon3.setBackgroundDrawable(icon3);
    tvIcon3.setClickable(true);

    Drawable icon4 = OneDrawable.createBgDrawableWithAlphaMode(this, R.drawable.ic_action_name, 0.3f);
    tvIcon4.setBackgroundDrawable(icon4);
    tvIcon4.setClickable(true);

    Drawable color1 = OneDrawable.createBgColorWithAlphaMode(this, getResources().getColor(R.color.colorPrimary));
    tvColor1.setBackgroundDrawable(color1);
    tvColor1.setClickable(true);

    Drawable color2 = OneDrawable.createBgColor(this, getResources().getColor(R.color.colorAccent));
    tvColor2.setBackgroundDrawable(color2);
    tvColor2.setClickable(true);
    tvColor2.setEnabled(false);
    tvColor2.postDelayed(new Runnable() {
        @Override
        public void run() {
            tvColor2.setEnabled(true);
        }
    }, 1000);

    Drawable color3 = OneDrawable.createBgColor(this, Color.parseColor("#cccccc"));
    tvColor3.setBackgroundDrawable(color3);
    tvColor3.setClickable(true);
    tvColor3.setEnabled(false);
    tvColor3.postDelayed(new Runnable() {
        @Override
        public void run() {
            tvColor3.setEnabled(true);
        }
    }, 1000);
}