@Override
  public View getView(int position, View convertView, ViewGroup parent) {
    Activity activity = (Activity) getContext();
    LayoutInflater inflater = activity.getLayoutInflater();

    View rowView = inflater.inflate(R.layout.news, null);
    Article article = getItem(position);

    TextView textView = (TextView) rowView.findViewById(R.id.article_title_text);
    textView.setText(article.getTitle());

    TextView dateView = (TextView) rowView.findViewById(R.id.article_listing_smallprint);
    String pubDate = article.getPubDate();
    // SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss Z", Locale.ENGLISH);
    // Date pDate;
    //	pDate = (Date) df.parse(pubDate);
    pubDate = "published " + "by " + article.getAuthor();
    // pubDate = article.getGuid();
    // + DateUtils.getDateDifference(pDate) +
    dateView.setText(pubDate);

    if (!article.isRead()) {
      LinearLayout row = (LinearLayout) rowView.findViewById(R.id.article_row_layout);
      row.setBackgroundColor(Color.WHITE);
      textView.setTypeface(Typeface.DEFAULT_BOLD);
    }
    return rowView;
  }
Пример #2
0
  private void criarSeletor(Integer position, View view) {
    LinearLayout ln = (LinearLayout) view.findViewById(R.id.listln);
    TextView tx = (TextView) view.findViewById(R.id.textmenu);

    if (itemPosition.equals(
        position)) { // criando seletor e setando a cor do texto mediante a selecao do usuario
      ln.setBackgroundColor(context.getResources().getColor(R.color.preto_claro));
      switch (itemPosition) {
        case 1:
          tx.setTextColor(view.getResources().getColor(R.color.verde));
          break;

        case 2:
          tx.setTextColor(view.getResources().getColor(R.color.vermelho_claro));
          break;
        case 3:
          tx.setTextColor(view.getResources().getColor(R.color.azul_piscina));
          break;

        default:
          tx.setTextColor(view.getResources().getColor(R.color.branco));
          break;
      }
    } else {
      ln.setBackgroundColor(context.getResources().getColor(R.color.preto));
      tx.setTextColor(view.getResources().getColor(R.color.branco));
    }
  }
Пример #3
0
  public View getView(int posicao, View convertView, ViewGroup parent) {
    Aluno aluno = alunos.get(posicao);

    LayoutInflater layoutInflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = layoutInflater.inflate(R.layout.alunoadapter, null);

    LinearLayout fundo = (LinearLayout) view.findViewById(R.id.fundo);

    if (posicao % 2 == 0) {
      fundo.setBackgroundColor(0xFF606060);
    } else {
      fundo.setBackgroundColor(0xFFB0B0B0);
    }

    ImageView foto = (ImageView) view.findViewById(R.id.foto);
    Bitmap bm = BitmapFactory.decodeResource(context.getResources(), R.drawable.noimage);

    if (aluno.getFoto() != null) {
      bm = BitmapFactory.decodeFile(aluno.getFoto());
    }

    bm = Bitmap.createScaledBitmap(bm, 100, 100, true);
    foto.setImageBitmap(bm);

    TextView nome = (TextView) view.findViewById(R.id.nome);
    nome.setText(aluno.toString());

    return view;
  }
Пример #4
0
  public void zadet(View v) {
    switch (v.getId()) {
      case R.id.circle1:
        zadeti[0] = true;
        l1.setBackgroundColor(0);
        break;
      case R.id.circleL1:
        zadeti[1] = true;
        l2.setBackgroundColor(0);
        break;
      case R.id.circleL2:
        zadeti[2] = true;
        l3.setBackgroundColor(0);
        break;
    }
    boolean vsi = false;
    for (boolean b : zadeti) {
      if (!b) {
        vsi = false;
        break;
      } else vsi = true;
    }

    if (vsi) {
      TextView tv = (TextView) findViewById(R.id.tv_krog);
      tv.setText("");
      TextView tv1 = (TextView) findViewById(R.id.steviloZadetih);
      tv1.setText("Bravo, prepoznal si vse kroge.");
    }
  }
  public boolean onTouch(View v, MotionEvent e) {
    switch (e.getAction()) {
      case MotionEvent.ACTION_DOWN:
        if (v.getId() == R.id.l1) {
          l1.setBackgroundColor(Color.GRAY);
        }
        if (v.getId() == R.id.l2) {
          l2.setBackgroundColor(Color.GRAY);
        }
        if (v.getId() == R.id.l3) {
          l3.setBackgroundColor(Color.GRAY);
        }
        break;
      case MotionEvent.ACTION_UP:
        if (v.getId() == R.id.l1) {
          l1.setBackgroundColor(Color.WHITE);

          Intent intent = new Intent();
          intent.putExtra("select", "1");
          intent.setAction("shijian");
          context.sendBroadcast(intent);
          this.dismiss();
          //                      Toast.makeText(context, "ok", Toast.LENGTH_LONG).show();
        }
        if (v.getId() == R.id.l2) {
          l2.setBackgroundColor(Color.WHITE);
          Intent intent = new Intent();
          intent.putExtra("select", "2");
          intent.setAction("shijian");
          context.sendBroadcast(intent);

          this.dismiss();
        }
        if (v.getId() == R.id.l3) {
          l3.setBackgroundColor(Color.WHITE);
          Intent intent = new Intent();
          intent.putExtra("select", "3");
          intent.setAction("shijian");
          context.sendBroadcast(intent);
          //  Toast.makeText(context,"ok",Toast.LENGTH_LONG).show();
          this.dismiss();
        }
        break;
      case MotionEvent.ACTION_CANCEL:
        if (v.getId() == R.id.l1) {
          l1.setBackgroundColor(Color.WHITE);
        }
        if (v.getId() == R.id.l2) {
          l1.setBackgroundColor(Color.WHITE);
        }
        if (v.getId() == R.id.l3) {
          l1.setBackgroundColor(Color.WHITE);
        }
        break;
    }
    return true;
  }
Пример #6
0
  private void setHighlightedColor(int previewNumber) {
    int children = colorPreview.getChildCount();
    if (children == 0 || colorPreview.getVisibility() != View.VISIBLE) return;

    for (int i = 0; i < children; i++) {
      View childView = colorPreview.getChildAt(i);
      if (!(childView instanceof LinearLayout)) continue;
      LinearLayout childLayout = (LinearLayout) childView;
      if (i == previewNumber) {
        childLayout.setBackgroundColor(Color.WHITE);
      } else {
        childLayout.setBackgroundColor(Color.TRANSPARENT);
      }
    }
  }
Пример #7
0
  protected void dispatchDraw(Canvas canvas) {
    Log.d(LOG_TAG, "dispatchDraw");
    super.dispatchDraw(canvas);
    if (!hasInit) {
      hasInit = true;
      indexPage = 0;
      if (mPageAdapter == null) {
        throw new RuntimeException("please set the PageAdapter on init");
      }
      totalPageNum = mPageAdapter.getCount();
      mainLayout = new LinearLayout(mContext);
      mainLayout.setLayoutParams(new LayoutParams(contentWidth, contentHeight));
      mainLayout.setBackgroundColor(0xffffffff);
      mState = BookState.READY;

      invisibleLayout = new LinearLayout(mContext);
      invisibleLayout.setLayoutParams(new LayoutParams(contentWidth, contentHeight));

      this.addView(invisibleLayout);
      this.addView(mainLayout);

      mBookView = new BookView(mContext);
      mBookView.setLayoutParams(new LayoutParams(contentWidth, contentHeight));
      this.addView(mBookView);

      updatePageView();
      invalidate();
    } else if (mState == BookState.READY) {
      mBookView.update();
    }
  }
Пример #8
0
  public void updateMainContent(Card cc) {
    TextView cash = (TextView) findViewById(R.id.menu_text);
    if (game.getAddedCash() > 0)
      cash.setText("Cash: $" + game.getCash() + "  (+$" + game.getAddedCash() + ")");
    else if (game.getAddedCash() < 0)
      cash.setText("Cash: $" + game.getCash() + "  ($" + game.getAddedCash() + ")");
    else cash.setText("Cash: $" + game.getCash());

    LinearLayout ll = (LinearLayout) findViewById(R.id.linearLayout3);
    new Color();
    ll.setBackgroundColor(
        Color.rgb(
            game.getCurrentCard().getColor()[0],
            game.getCurrentCard().getColor()[1],
            game.getCurrentCard().getColor()[2]));

    TextView h1 = (TextView) findViewById(R.id.textView1);
    h1.setText(cc.getStreet().toUpperCase());

    TextView h2 = (TextView) findViewById(R.id.textView2);
    h2.setText(cc.getArea());

    TextView own = (TextView) findViewById(R.id.textView3);
    own.setText("" + cc.getOwner());

    TextView val = (TextView) findViewById(R.id.textView4);
    val.setText("$" + Integer.toString(cc.getValue()));

    TextView tax = (TextView) findViewById(R.id.textView5);
    tax.setText("$" + Integer.toString(cc.getTax()));

    TextView hou = (TextView) findViewById(R.id.textView6);
    String pri = new String();
    if (cc.getHousePrise() <= 0) pri = " --";
    else pri = Integer.toString(cc.getHousePrise());
    hou.setText("$" + pri);

    // The buttons
    buyStreet.setEnabled(
        game.getCash() >= game.getCurrentCard().getValue()
            && game.getCurrentCard().getStreet() != GameMechanics.DEFAULT_STREET
            && game.getPlayer().getUserId() != game.getCurrentCard().getOwnerId());

    buyHouse.setEnabled(
        game.getCash() >= game.getCurrentCard().getHousePrise()
            && game.getCurrentCard().getHouses() < 5
            && game.getCurrentCard().getStreet() != GameMechanics.DEFAULT_STREET
            && game.getPlayer().getUserId() == game.getCurrentCard().getOwnerId());

    // Do the houses
    for (int i = 1; i <= 5; i++) {
      ImageView houses = new ImageView(this);
      houses = (ImageView) findViewById(ivid[i]);
      if (cc.getHouses() >= i) houses.setImageResource(hoid[i]);
      else houses.setImageResource(hoid[0]);
      houses.invalidate();
    }

    return;
  }
Пример #9
0
  public void addNavBar(String title, Map<Object, Object> left, Map<Object, Object> right) {
    removeNavBar();

    Context ctx = RhodesActivity.getContext();

    LinearLayout top = new LinearLayout(ctx);
    top.setOrientation(LinearLayout.HORIZONTAL);
    top.setBackgroundColor(Color.GRAY);
    top.setGravity(Gravity.CENTER);
    top.setLayoutParams(new LinearLayout.LayoutParams(FILL_PARENT, WRAP_CONTENT, 0));

    View leftButton = createButton(left);
    leftButton.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1));
    top.addView(leftButton);

    TextView label = new TextView(ctx);
    label.setText(title);
    label.setGravity(Gravity.CENTER);
    label.setTextSize((float) 30.0);
    label.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 2));
    top.addView(label);

    if (right != null) {
      View rightButton = createButton(right);
      rightButton.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1));
      top.addView(rightButton);
    }

    navBar = top;
    view.addView(navBar, 0);
  }
Пример #10
0
  @Override
  protected void onCreate(Bundle state) {
    super.onCreate(state);

    setRequestedOrientation(SCREEN_ORIENTATION_NOSENSOR);

    String qrData = getIntent().getStringExtra(Intent.EXTRA_TEXT);

    cameraView = new CameraView(this);
    cameraBorder = new LinearLayout(this);
    cameraBorder.setGravity(CENTER);
    cameraBorder.setBackgroundColor(BLACK);
    cameraBorder.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT, 1f));
    cameraBorder.addView(cameraView);

    ImageView qrCodeView = new ImageView(this);

    qrCodeView.setScaleType(FIT_CENTER);
    qrCodeView.setBackgroundColor(WHITE);
    qrCodeView.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT, 1f));

    Display display = getWindowManager().getDefaultDisplay();
    boolean portrait = display.getWidth() < display.getHeight();
    layoutMain = new LinearLayout(this);
    if (portrait) layoutMain.setOrientation(VERTICAL);
    else layoutMain.setOrientation(HORIZONTAL);
    layoutMain.setWeightSum(2);
    layoutMain.addView(cameraBorder);
    layoutMain.addView(qrCodeView);
    setContentView(layoutMain);

    new QrGenAsyncTask(this, qrCodeView).execute(qrData);
  }
Пример #11
0
  public static void makeText(Context context, String text, int duration) {
    getInstance(context);
    getToast(duration);
    if (mInstance.layout == null || mInstance.tv == null) {
      LinearLayout container = new LinearLayout(mContext);
      LinearLayout.LayoutParams rootParams =
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
      container.setLayoutParams(rootParams);
      container.setBackgroundColor(context.getResources().getColor(android.R.color.transparent));
      container.setGravity(Gravity.CENTER);

      mInstance.tv = new TextView(mContext);
      LinearLayout.LayoutParams tvParams =
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
      mInstance.tv.setLayoutParams(tvParams);
      mInstance.tv.setPadding(dp2px(10), dp2px(2), dp2px(10), dp2px(2));
      mInstance.tv.setGravity(Gravity.CENTER);
      mInstance.tv.setTextColor(DEFAULT_TEXT_COLOR);
      mInstance.tv.setMaxLines(2);
      mInstance.tv.setEllipsize(TextUtils.TruncateAt.END);
      mInstance.tv.setTextSize(DEFAULT_TEXT_SIZE);
      mInstance.tv.setBackgroundResource(DEFAULT_BG_TEXT);

      container.addView(mInstance.tv);
      mInstance.layout = container;
      mToast.setView(mInstance.layout);
    }
    mInstance.tv.setText(text);
    mToast.show();
  }
Пример #12
0
  public void setLayoutColor(
      ArrayList<String> list1,
      ArrayList<String> list2,
      ArrayList<String> list3,
      int count,
      int count2,
      int count3) {
    String filePath1 = list1.get(count);
    String filePath2 = list2.get(count2);

    String filePath3 = list3.get(count3);

    Bitmap bmp1 = BitmapFactory.decodeFile(filePath1);

    Bitmap bmp3 = BitmapFactory.decodeFile(filePath3);
    LinearLayout l1 = (LinearLayout) findViewById(R.id.swipe);
    String color = "";

    if (filePath2.length() > 1) {
      Bitmap bmp2 = BitmapFactory.decodeFile(filePath2);
      color = getLayoutColor(bmp1, bmp2, bmp3);
    } else {
      color = getLayoutColorNoBottoms(bmp1, bmp3);
    }

    l1.setBackgroundColor(Color.parseColor(color));
  }
Пример #13
0
  public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
    if (colorPreview == null) return;
    this.colorPreview = colorPreview;
    if (selectedColor == null) selectedColor = 0;
    int children = colorPreview.getChildCount();
    if (children == 0 || colorPreview.getVisibility() != View.VISIBLE) return;

    for (int i = 0; i < children; i++) {
      View childView = colorPreview.getChildAt(i);
      if (!(childView instanceof LinearLayout)) continue;
      LinearLayout childLayout = (LinearLayout) childView;
      if (i == selectedColor) {
        childLayout.setBackgroundColor(Color.WHITE);
      }
      ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
      childImage.setClickable(true);
      childImage.setTag(i);
      childImage.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              if (v == null) return;
              Object tag = v.getTag();
              if (tag == null || !(tag instanceof Integer)) return;
              setSelectedColor((int) tag);
            }
          });
    }
  }
 private void showWidgets() {
   captionLayout.setBackgroundColor(Color.TRANSPARENT);
   titleTextView.setVisibility(View.VISIBLE);
   captionTextView.setVisibility(View.VISIBLE);
   cameraButton.setVisibility(View.VISIBLE);
   addPicturesButton.setVisibility(View.VISIBLE);
 }
Пример #15
0
  private void dialogie(String s) {
    if (s == null || s.length() == 0) return;

    AlertDialog ad = new AlertDialog.Builder(me).create();
    ad.setCancelable(true);
    ad.setCanceledOnTouchOutside(true);
    ad.setTitle("Linkification view");

    LinearLayout rl = new LinearLayout(me);
    rl.setBackgroundColor(Color.WHITE);
    rl.setPadding(scalemex(5), scalemex(25), scalemex(5), scalemex(25));

    TextView tv;

    tv = new TextView(me);
    rl.addView(tv);
    tv.setBackgroundColor(Color.WHITE);
    tv.setTextColor(Color.BLACK);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19f);
    tv.setText(s);
    Linkify.addLinks(tv, Linkify.ALL);

    ScrollView ho = new ScrollView(me);
    ho.addView(rl);

    ad.setView(ho);
    ad.show();
  }
Пример #16
0
  /** 初始化,查找ID,获取天气配置文件,设置容器属性 */
  private void init() {
    mWeatherContainer = new LinearLayout(context);
    // 利用工厂模式,获取天气业务对象,得到天气配置信息
    mWeatherEngine = BeanFactory.getImpl(WeatherEngine.class);
    config = mWeatherEngine.getWeatherConfig();

    String mAndroidIdStr = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
    mAndroidIdStr = mAndroidIdStr.replace("-", "").replace(" ", "").toUpperCase();
    mAndroidId = getLongAndroidId(mAndroidIdStr);
    Long num = Long.parseLong(mAndroidId);
    // 周列表,获取对应在数字,好直接从res/arrays获取不同国家的语言
    mWeekList = new ArrayList<String>();
    mWeekList.add("Sun");
    mWeekList.add("Mon");
    mWeekList.add("Tue");
    mWeekList.add("Wed");
    mWeekList.add("Thu");
    mWeekList.add("Fri");
    mWeekList.add("Sat");

    // 容器的大小及位置由用户指定
    RelativeLayout.LayoutParams params =
        new RelativeLayout.LayoutParams(
            DensityUtil.dip2px(context, config.getWidth()),
            DensityUtil.dip2px(context, config.getHeight()));
    mWeatherContainer.setLayoutParams(params);
    // mWeatherContainer.layout(config.getStartX(), config.getStartY(),
    // DensityUtil.px2dip(MainActivity.this, config.getWidth()),
    // DensityUtil.px2dip(MainActivity.this, config.getHeight()));
    mWeatherContainer.setBackgroundColor(Color.YELLOW);
  }
Пример #17
0
  public QuickAction(View anchor, String header) {
    super(anchor);

    context = anchor.getContext();
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    root = (ViewGroup) inflater.inflate(R.layout.popup, null);

    mHeaderLabel = (TextView) root.findViewById(R.id.popup_wnd_header);
    LinearLayout mHeaderDivider = (LinearLayout) root.findViewById(R.id.popup_header_divider);
    if (header != null) {
      mHeaderDivider.setBackgroundColor(ColorScheme.getColor(4));
      mHeaderLabel.setTextColor(ColorScheme.getColor(2));
      mHeaderLabel.setText(header);
    } else {
      mHeaderDivider.setVisibility(View.GONE);
      mHeaderLabel.setVisibility(View.GONE);
    }
    LinearLayout mContainer = (LinearLayout) root.findViewById(R.id.popup_container);
    Interface.attachBackground(mContainer, Interface.status_selector_back);

    setContentView(root);

    mTrack = (ViewGroup) root.findViewById(R.id.tracks);
    animStyle = ANIM_AUTO;
  }
Пример #18
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = activity.getActionBar();
    View view = actionBar.getCustomView();
    ImageView title_image = (ImageView) view.findViewById(R.id.title_image);
    title_image.setBackgroundResource(R.drawable.substancea_cs);

    ScrollView sv = new ScrollView(activity);
    sv.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    sv.setFillViewport(true);

    LinearLayout lay = new LinearLayout(activity);
    lay.setOrientation(LinearLayout.VERTICAL);
    lay.setBackgroundColor(Color.WHITE);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    sv.addView(lay, params);
    // setContentView(sv);

    search_lay.setOnClickListener(searchLis);
    search_btn.setOnClickListener(searchLis);
    showLinelay = new LinearLayout(activity);
    ((LinearLayout) showLinelay).setOrientation(LinearLayout.VERTICAL);
    lay.addView(showLinelay, params);
    initNet();
    loadData(new RequestPram());
  }
Пример #19
0
  private void init(MainView v, Object params) {
    Context ctx = RhodesActivity.getContext();

    view = new MyView(ctx);
    view.setOrientation(LinearLayout.VERTICAL);
    view.setGravity(Gravity.BOTTOM);
    view.setLayoutParams(new LinearLayout.LayoutParams(FILL_PARENT, FILL_PARENT));

    webView = null;
    if (v != null) webView = v.detachWebView();
    if (webView == null) webView = RhodesActivity.safeGetInstance().createWebView();
    view.addView(webView, new LinearLayout.LayoutParams(FILL_PARENT, 0, 1));

    LinearLayout bottom = new LinearLayout(ctx);
    bottom.setOrientation(LinearLayout.HORIZONTAL);
    bottom.setBackgroundColor(Color.GRAY);
    bottom.setLayoutParams(new LinearLayout.LayoutParams(FILL_PARENT, WRAP_CONTENT, 0));
    view.addView(bottom);

    toolBar = bottom;

    setupToolbar(toolBar, params);

    webView.requestFocus();
  }
  public static WaitDialog showNormalWithHintProgress(Context mContext, String hint, boolean show) {
    LinearLayout ll = null;
    if (show) {
      ll = new LinearLayout(mContext);
      ll.setBackgroundColor(Color.TRANSPARENT);
      ll.setOrientation(LinearLayout.VERTICAL);

      ImageView iv = new ImageView(mContext);
      iv.setImageResource(R.drawable.spin_black_70);
      iv.setPadding(20, 20, 20, 20);
      ll.addView(
          iv,
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
      ll.setTag(iv);

      TextView tv = new TextView(mContext);
      tv.setText(hint);
      ll.addView(
          tv,
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

      ll.setGravity(Gravity.CENTER);
    } else ll = null;
    return showProgress(mContext, show, ll);
  }
Пример #21
0
 public void setToolbar(Object params) {
   toolBar.setBackgroundColor(Color.GRAY);
   toolBar.removeAllViews();
   setupToolbar(toolBar, params);
   toolBar.requestLayout();
   view.requestLayout();
 }
  private void createView() {
    // Linear Layout
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setId(1);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.setBackgroundColor(Color.BLACK);
    this.setContentView(linearLayout);

    // Relative Layout
    RelativeLayout relativeLayout = new RelativeLayout(this);
    relativeLayout.setId(2);
    relativeLayout.setGravity(Gravity.CENTER);
    relativeLayout.setBackgroundColor(Color.BLACK);
    RelativeLayout.LayoutParams relativeLayoutParams =
        new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
    relativeLayout.setLayoutParams(relativeLayoutParams);
    linearLayout.addView(relativeLayout);

    // Video View
    videoView = new VideoView(this);
    videoView.setId(3);
    RelativeLayout.LayoutParams videoViewParams =
        new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    videoViewParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    videoView.setLayoutParams(videoViewParams);
    relativeLayout.addView(videoView);
  }
Пример #23
0
 public CustomDialog(Context context) {
   super(context);
   items = new ArrayList<>();
   icon = getContext().getResources().getDimensionPixelSize(R.dimen.dimen_32_dp);
   padding = getContext().getResources().getDimensionPixelSize(R.dimen.dimen_8_dp);
   ViewGroup.LayoutParams params =
       new ViewGroup.LayoutParams(
           ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
   container = new LinearLayout(getContext());
   container.setLayoutParams(params);
   container.setBackgroundColor(Color.WHITE);
   container.setOrientation(LinearLayout.VERTICAL);
   container.setPadding(0, padding, 0, padding);
   ScrollView scrollView = new ScrollView(getContext());
   scrollView.addView(container);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   setContentView(scrollView, params);
   setCancelable(true);
   setCanceledOnTouchOutside(true);
   getWindow().setGravity(Gravity.BOTTOM);
   getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
   getWindow()
       .setLayout(
           WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
   getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
 }
Пример #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    LinearLayout myLayout = new LinearLayout(this);
    myLayout.setOrientation(LinearLayout.VERTICAL);

    input1 = new EditText(this);
    output1 = new TextView(this);

    button1 = new Button(this);

    bannerText = new TextView(this);

    myLayout.setOrientation(LinearLayout.VERTICAL);
    myLayout.setGravity(Gravity.CENTER_HORIZONTAL);
    myLayout.setBackgroundColor(Color.LTGRAY);

    bannerText.setWidth(300);
    bannerText.setGravity(Gravity.CENTER_HORIZONTAL);
    bannerText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 50);
    bannerText.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
    bannerText.setText(" Currency Converter from Dollar $ to Birr");
    bannerText.setTextColor(Color.BLUE);
    bannerText.setPadding(0, 0, 0, 10);

    input1.setHint("Enter Dollar amount");
    button1.setText("Convert to Birr!");

    output1.setText("0");
    output1.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    output1.setPadding(0, 20, 0, 20);
    output1.setWidth(150);
    output1.setGravity(Gravity.CENTER_HORIZONTAL);
    output1.setTextColor(Color.WHITE);

    // button1.setOnClickListener(myListener);

    button1.setOnClickListener(this);

    myLayout.addView(bannerText);
    myLayout.addView(input1);
    myLayout.addView(output1);

    myLayout.addView(button1);

    LinearLayout.LayoutParams parm = new RadioGroup.LayoutParams(300, 100);

    input1.setLayoutParams(parm);
    output1.setLayoutParams(parm);
    button1.setLayoutParams(parm);

    setContentView(myLayout);

    input1.setLayoutParams(new LinearLayout.LayoutParams(225, 50));
    button1.setLayoutParams(new LinearLayout.LayoutParams(170, 50));
    // button2.setLayoutParams(new LinearLayout.LayoutParams(170, 50));

  }
  @SuppressWarnings("deprecation")
  protected void createViews() {
    // This builds the view.  We could probably get away with NOT having a LinearLayout, but I like
    // having a bucket!
    // This builds the view.  We could probably get away with NOT having a LinearLayout, but I like
    // having a bucket!
    Display display = getWindowManager().getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();

    root = new LinearLayoutSoftKeyboardDetect(this, width, height);
    root.setOrientation(LinearLayout.VERTICAL);
    root.setLayoutParams(
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0F));

    appView.setId(100);
    appView.setLayoutParams(
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1.0F));

    // Add web view but make it invisible while loading URL
    appView.setVisibility(View.INVISIBLE);
    root.addView((View) appView);
    setContentView(root);

    // TODO: Setting this on the appView causes it to show when <html style="opacity:0">.
    int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
    root.setBackgroundColor(backgroundColor);
  }
Пример #26
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    mFavoritesBackground = (LinearLayout) findViewById(R.id.starred_contacts);
    mFavoritesBackground.setBackgroundColor(ThemeManager.getBackgroundColor());

    mTitle = (QKTextView) findViewById(R.id.title);

    mFavorites = (LinearLayout) findViewById(R.id.favorites);

    mToggle = findViewById(R.id.toggle);
    mToggle.setOnClickListener(this);

    mIndicator = (ImageView) findViewById(R.id.indicator);

    if (mPrefs.getBoolean(SettingsFragment.COMPOSE_FAVORITES, true)) {
      expand();
    } else {
      collapse();
    }

    LiveViewManager.registerView(this);
    LiveViewManager.registerPreference(this, SettingsFragment.BACKGROUND);
    refresh();
  }
Пример #27
0
 private void doStufftwo() {
   ll_ColorChange.setBackgroundColor(Color.WHITE);
   tv_Name.setText("");
   tv_Aadhaar.setText("");
   tv_Punch_time.setText("");
   iv_VerifyFinger.setImageBitmap(null);
 }
Пример #28
0
  public void step2(CalendarConfig config) {
    this.config = config;

    //
    // findViewById(getResourseIdByName(mContext.getPackageName(),"id","galley_calendar")).setBackgroundColor(config.getLAYOUT_COLOR());
    findViewById(R.id.galley_calendar).setBackgroundColor(config.getLAYOUT_COLOR());

    calendarLayout.setBackgroundColor(config.getLAYOUT_COLOR());

    pre_month_icon_in_layout.setText(config.getPRE_MONTH_ARROW());
    next_month_icon_in_layout.setText(config.getNEXT_MONTH_ARROW());
    calendar_open.setText(config.getOPEN_BIG_CALENDAR());
    calendar_close.setText(config.getCLOSE_BIG_CALENDAR());

    preMonth.setTextColor(config.getHIDE_COLOR());
    nextMonth.setTextColor(config.getHIDE_COLOR());

    calendarsAdapter.setColor(config.getLAYOUT_COLOR(), config.getHIDE_COLOR());
    //        adapter.setColor(config.getLAYOUT_COLOR(),config.getHIDE_COLOR());

    if (config.getTypeface() != null) {
      calendar_open.setTypeface(config.getTypeface());
      calendar_close.setTypeface(config.getTypeface());
      next_month_icon_in_layout.setTypeface(config.getTypeface());
      pre_month_icon_in_layout.setTypeface(config.getTypeface());
    }
  }
Пример #29
0
  /** 对拖拽图片不同的点击事件处理 */
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    int X = (int) event.getX();

    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN:
        dragBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.lock_touch);
        heartView.setImageBitmap(dragBitmap);
        linearLayoutL.setBackgroundResource(R.drawable.left_bg_default);
        linearLayoutR.setBackgroundResource(R.drawable.left_bg_default);
        locationX = (int) event.getX();
        Log.i(TAG, "是否点击到位=" + isActionDown(event));
        return isActionDown(event); // 判断是否点击了滑动区�?

      case MotionEvent.ACTION_MOVE: // 保存x轴方向,绘制图画
        locationX = X;
        invalidate(); // 重新绘图
        return true;

      case MotionEvent.ACTION_UP: // 判断是否解锁成功
        dragBitmap =
            BitmapFactory.decodeResource(context.getResources(), R.drawable.icon_slide_circle_n);
        heartView.setImageBitmap(dragBitmap);
        linearLayoutL.setBackgroundColor(getResources().getColor(R.color.transparent));
        linearLayoutR.setBackgroundResource(getResources().getColor(R.color.transparent));
        if (!unLockLeft() && !unLockRight()) { // 没有解锁成功,动画应该回滚
          flag = false;
          handleActionUpEvent(event); // 动画回滚
        }
        return true;
    }
    return super.onTouchEvent(event);
  }
Пример #30
0
  private View createNameDialog(String titleText, String value, int identifier) {
    Point windowSize = getWindowSize(mContext.getWindowManager().getDefaultDisplay());
    int five_dip = ConvertToPx(mContext, 5);
    int dialogWidth = windowSize.x - 10 * five_dip;

    LinearLayout mainContainer = new LinearLayout(mContext);
    mainContainer.setOrientation(LinearLayout.VERTICAL);
    mainContainer.addView(getTitleTextView(titleText));
    mainContainer.setBackgroundColor(Color.argb(180, 255, 255, 255));

    LinearLayout.LayoutParams layoutParams =
        new LinearLayout.LayoutParams(dialogWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
    RelativeLayout.LayoutParams verticalDivider_params =
        new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1);
    layoutParams.gravity = Gravity.CENTER;
    mainContainer.setLayoutParams(layoutParams);

    EditText tv = new EditText(mContext);
    tv.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
    tv.setText(value);
    tv.setEnabled(false);
    tv.setTextColor(Color.BLACK);
    tv.setGravity(Gravity.CENTER);
    layoutParams.setMargins(five_dip, five_dip * 3, five_dip, five_dip);
    tv.setLayoutParams(layoutParams);
    mainContainer.addView(tv);
    mainContainer.addView(getDivider(verticalDivider_params));
    addAlphabets(mainContainer);

    addButtons(mainContainer, identifier);
    edit_PlayerName = tv;
    return mainContainer;
  }