android.widget.LinearLayout#postDelayed ( )源码实例Demo

下面列出了android.widget.LinearLayout#postDelayed ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TelePlus-Android   文件: VoIPActivity.java
private void showDebugAlert() {
      if(VoIPService.getSharedInstance()==null)
          return;
VoIPService.getSharedInstance().forceRating();
final LinearLayout debugOverlay=new LinearLayout(this);
      debugOverlay.setOrientation(LinearLayout.VERTICAL);
      debugOverlay.setBackgroundColor(0xCC000000);
      int pad=AndroidUtilities.dp(16);
      debugOverlay.setPadding(pad, pad*2, pad, pad*2);

      TextView title=new TextView(this);
      title.setTextColor(0xFFFFFFFF);
      title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
      title.setTypeface(Typeface.DEFAULT_BOLD);
      title.setGravity(Gravity.CENTER);
      title.setText("libtgvoip v"+VoIPController.getVersion());
      debugOverlay.addView(title, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 16));

      ScrollView scroll=new ScrollView(this);
      final TextView debugText=new TextView(this);
      debugText.setTypeface(Typeface.MONOSPACE);
      debugText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
      debugText.setMaxWidth(AndroidUtilities.dp(350));
      debugText.setTextColor(0xFFFFFFFF);
      debugText.setText(getFormattedDebugString());
      scroll.addView(debugText);
      debugOverlay.addView(scroll, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 1f));

      TextView closeBtn=new TextView(this);
      closeBtn.setBackgroundColor(0xFFFFFFFF);
      closeBtn.setTextColor(0xFF000000);
      closeBtn.setPadding(pad, pad, pad, pad);
      closeBtn.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
      closeBtn.setText(LocaleController.getString("Close", R.string.Close));
      debugOverlay.addView(closeBtn, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 16, 0, 0));

      final WindowManager wm=(WindowManager) getSystemService(WINDOW_SERVICE);
      wm.addView(debugOverlay, new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_APPLICATION_PANEL, 0, PixelFormat.TRANSLUCENT));

      closeBtn.setOnClickListener(new View.OnClickListener(){
          @Override
          public void onClick(View v){
              wm.removeView(debugOverlay);
          }
      });

      final Runnable r = new Runnable() {
          @Override
          public void run() {
              if (isFinishing() || VoIPService.getSharedInstance() == null) {
                  return;
              }
              debugText.setText(getFormattedDebugString());
              debugOverlay.postDelayed(this, 500);
          }
      };
      debugOverlay.postDelayed(r, 500);
  }
 
源代码2 项目: TelePlus-Android   文件: VoIPActivity.java
private void showDebugAlert() {
      if(VoIPService.getSharedInstance()==null)
          return;
VoIPService.getSharedInstance().forceRating();
final LinearLayout debugOverlay=new LinearLayout(this);
      debugOverlay.setOrientation(LinearLayout.VERTICAL);
      debugOverlay.setBackgroundColor(0xCC000000);
      int pad=AndroidUtilities.dp(16);
      debugOverlay.setPadding(pad, pad*2, pad, pad*2);

      TextView title=new TextView(this);
      title.setTextColor(0xFFFFFFFF);
      title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
      title.setTypeface(Typeface.DEFAULT_BOLD);
      title.setGravity(Gravity.CENTER);
      title.setText("libtgvoip v"+VoIPController.getVersion());
      debugOverlay.addView(title, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 16));

      ScrollView scroll=new ScrollView(this);
      final TextView debugText=new TextView(this);
      debugText.setTypeface(Typeface.MONOSPACE);
      debugText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
      debugText.setMaxWidth(AndroidUtilities.dp(350));
      debugText.setTextColor(0xFFFFFFFF);
      debugText.setText(getFormattedDebugString());
      scroll.addView(debugText);
      debugOverlay.addView(scroll, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 1f));

      TextView closeBtn=new TextView(this);
      closeBtn.setBackgroundColor(0xFFFFFFFF);
      closeBtn.setTextColor(0xFF000000);
      closeBtn.setPadding(pad, pad, pad, pad);
      closeBtn.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
      closeBtn.setText(LocaleController.getString("Close", R.string.Close));
      debugOverlay.addView(closeBtn, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 16, 0, 0));

      final WindowManager wm=(WindowManager) getSystemService(WINDOW_SERVICE);
      wm.addView(debugOverlay, new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_APPLICATION_PANEL, 0, PixelFormat.TRANSLUCENT));

      closeBtn.setOnClickListener(new View.OnClickListener(){
          @Override
          public void onClick(View v){
              wm.removeView(debugOverlay);
          }
      });

      final Runnable r = new Runnable() {
          @Override
          public void run() {
              if (isFinishing() || VoIPService.getSharedInstance() == null) {
                  return;
              }
              debugText.setText(getFormattedDebugString());
              debugOverlay.postDelayed(this, 500);
          }
      };
      debugOverlay.postDelayed(r, 500);
  }
 
源代码3 项目: Telegram-FOSS   文件: VoIPActivity.java
private void showDebugAlert() {
    if (VoIPService.getSharedInstance() == null)
        return;
    VoIPService.getSharedInstance().forceRating();
    final LinearLayout debugOverlay = new LinearLayout(this);
    debugOverlay.setOrientation(LinearLayout.VERTICAL);
    debugOverlay.setBackgroundColor(0xCC000000);
    int pad = AndroidUtilities.dp(16);
    debugOverlay.setPadding(pad, pad * 2, pad, pad * 2);

    TextView title = new TextView(this);
    title.setTextColor(0xFFFFFFFF);
    title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    title.setTypeface(Typeface.DEFAULT_BOLD);
    title.setGravity(Gravity.CENTER);
    title.setText(getDebugTitle());
    debugOverlay.addView(title, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 16));

    ScrollView scroll = new ScrollView(this);
    final TextView debugText = new TextView(this);
    debugText.setTypeface(Typeface.MONOSPACE);
    debugText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
    debugText.setMaxWidth(AndroidUtilities.dp(350));
    debugText.setTextColor(0xFFFFFFFF);
    debugText.setText(getFormattedDebugString());
    scroll.addView(debugText);
    debugOverlay.addView(scroll, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 1f));

    TextView closeBtn = new TextView(this);
    closeBtn.setBackgroundColor(0xFFFFFFFF);
    closeBtn.setTextColor(0xFF000000);
    closeBtn.setPadding(pad, pad, pad, pad);
    closeBtn.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    closeBtn.setText(LocaleController.getString("Close", R.string.Close));
    debugOverlay.addView(closeBtn, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 16, 0, 0));

    final WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    wm.addView(debugOverlay, new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_APPLICATION_PANEL, 0, PixelFormat.TRANSLUCENT));

    closeBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            wm.removeView(debugOverlay);
        }
    });

    final Runnable r = new Runnable() {
        @Override
        public void run() {
            if (isFinishing() || VoIPService.getSharedInstance() == null) {
                return;
            }
            title.setText(getDebugTitle());
            debugText.setText(getFormattedDebugString());
            debugOverlay.postDelayed(this, 500);
        }
    };
    debugOverlay.postDelayed(r, 500);
}
 
源代码4 项目: Telegram   文件: VoIPActivity.java
private void showDebugAlert() {
    if (VoIPService.getSharedInstance() == null)
        return;
    VoIPService.getSharedInstance().forceRating();
    final LinearLayout debugOverlay = new LinearLayout(this);
    debugOverlay.setOrientation(LinearLayout.VERTICAL);
    debugOverlay.setBackgroundColor(0xCC000000);
    int pad = AndroidUtilities.dp(16);
    debugOverlay.setPadding(pad, pad * 2, pad, pad * 2);

    TextView title = new TextView(this);
    title.setTextColor(0xFFFFFFFF);
    title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    title.setTypeface(Typeface.DEFAULT_BOLD);
    title.setGravity(Gravity.CENTER);
    title.setText(getDebugTitle());
    debugOverlay.addView(title, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 16));

    ScrollView scroll = new ScrollView(this);
    final TextView debugText = new TextView(this);
    debugText.setTypeface(Typeface.MONOSPACE);
    debugText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
    debugText.setMaxWidth(AndroidUtilities.dp(350));
    debugText.setTextColor(0xFFFFFFFF);
    debugText.setText(getFormattedDebugString());
    scroll.addView(debugText);
    debugOverlay.addView(scroll, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 1f));

    TextView closeBtn = new TextView(this);
    closeBtn.setBackgroundColor(0xFFFFFFFF);
    closeBtn.setTextColor(0xFF000000);
    closeBtn.setPadding(pad, pad, pad, pad);
    closeBtn.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    closeBtn.setText(LocaleController.getString("Close", R.string.Close));
    debugOverlay.addView(closeBtn, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 16, 0, 0));

    final WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    wm.addView(debugOverlay, new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_APPLICATION_PANEL, 0, PixelFormat.TRANSLUCENT));

    closeBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            wm.removeView(debugOverlay);
        }
    });

    final Runnable r = new Runnable() {
        @Override
        public void run() {
            if (isFinishing() || VoIPService.getSharedInstance() == null) {
                return;
            }
            title.setText(getDebugTitle());
            debugText.setText(getFormattedDebugString());
            debugOverlay.postDelayed(this, 500);
        }
    };
    debugOverlay.postDelayed(r, 500);
}