Android Open Source - VideoExtand Title Bar






From Project

Back to project page VideoExtand.

License

The source code is released under:

Apache License

If you think the Android project VideoExtand listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (C) 2014 The Android Open Source Project
 */*from  w w  w.j ava 2s .  co  m*/
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Auther?yinglovezhuzhu@gmail.com
 * File: TitleBar.java
 * Date?2014?1?2?
 * Version?v1.0
 */  
package com.yuninfo.videoextand.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yuninfo.videoextand.utils.LogUtil;

/**
 * ???????
 * @author yinglovezhuzhu@gmail.com
 */
public class TitleBar extends LinearLayout {
  
  private ImageButton mIbtnLeft;
  private ImageButton mIbtnRight;
  private TextView mTvTitle;
  
  private Resources mResource;
  private String mPackageName;

  @SuppressLint("NewApi")
  public TitleBar(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    initView(context);
  }

  public TitleBar(Context context, AttributeSet attrs) {
    super(context, attrs);
    initView(context);
  }

  public TitleBar(Context context) {
    super(context);
    initView(context);
  }
  
  private void initView(Context context) {
    mResource = getResources();
    mPackageName = context.getPackageName();
    LogUtil.w("AAAAAAAAAAA", mPackageName);
    int layoutId = mResource.getIdentifier("yuninfo_layout_title", "layout", mPackageName);
    View.inflate(context, layoutId, this);
    mIbtnLeft = (ImageButton) findViewById(mResource.getIdentifier("yuninfo_ibtn_title_left", "id", mPackageName));
    mTvTitle = (TextView) findViewById(mResource.getIdentifier("yuninfo_tv_title_text", "id", mPackageName));
    mIbtnRight = (ImageButton) findViewById(mResource.getIdentifier("yuninfo_ibtn_title_right", "id", mPackageName));
    mIbtnLeft.setVisibility(View.INVISIBLE);
    mIbtnRight.setVisibility(View.INVISIBLE);
  }

  
  public void setTitleText(CharSequence text) {
    mTvTitle.setText(text);
  }
  
  public void setTitleText(int resid) {
    mTvTitle.setText(resid);
  }
  
  public void setLeftButton(int resId, View.OnClickListener listener) {
    mIbtnLeft.setImageResource(resId);
    mIbtnLeft.setOnClickListener(listener);
    mIbtnLeft.setVisibility(View.VISIBLE);
  }
  
  public void setLeftButton(Drawable drawable, View.OnClickListener listener) {
    mIbtnLeft.setImageDrawable(drawable);
    mIbtnLeft.setOnClickListener(listener);
    mIbtnLeft.setVisibility(View.VISIBLE);
  }
  
  public void setLeftButton(Bitmap bitmap, View.OnClickListener listener) {
    mIbtnLeft.setImageBitmap(bitmap);
    mIbtnLeft.setOnClickListener(listener);
    mIbtnLeft.setVisibility(View.VISIBLE);
  }
  
  public void setRightButton(int resId, View.OnClickListener listener) {
    mIbtnRight.setImageResource(resId);
    mIbtnRight.setOnClickListener(listener);
    mIbtnRight.setVisibility(View.VISIBLE);
  }
  
  public void setRightButton(Drawable drawable, View.OnClickListener listener) {
    mIbtnRight.setImageDrawable(drawable);
    mIbtnRight.setOnClickListener(listener);
    mIbtnRight.setVisibility(View.VISIBLE);
  }
  
  public void setRightButton(Bitmap bitmap, View.OnClickListener listener) {
    mIbtnRight.setImageBitmap(bitmap);
    mIbtnRight.setOnClickListener(listener);
    mIbtnRight.setVisibility(View.VISIBLE);
  }
  
  public void setLeftButtonVisibility(int visibility) {
    mIbtnLeft.setVisibility(visibility);
  }
  
  public void setRightButtonVisibility(int visibility) {
    mIbtnRight.setVisibility(visibility);
  }
  
}




Java Source Code List

com.example.androidtest.MainActivity.java
com.yuninfo.videoextand.BaseActivity.java
com.yuninfo.videoextand.Config.java
com.yuninfo.videoextand.ReadCardActivity.java
com.yuninfo.videoextand.SendCardActivity.java
com.yuninfo.videoextand.bean.CommonReq.java
com.yuninfo.videoextand.bean.ReadVideoResp.java
com.yuninfo.videoextand.bean.SendVideoResp.java
com.yuninfo.videoextand.bean.UploadReq.java
com.yuninfo.videoextand.bean.UploadResp.java
com.yuninfo.videoextand.player.VideoPlayerActivity.java
com.yuninfo.videoextand.recorder.RecorderActivity.java
com.yuninfo.videoextand.uploader.ProgressListener.java
com.yuninfo.videoextand.uploader.ProgressMultipartEntity.java
com.yuninfo.videoextand.uploader.ProgressOutputStream.java
com.yuninfo.videoextand.uploader.UploadHandler.java
com.yuninfo.videoextand.uploader.UploadThread.java
com.yuninfo.videoextand.utils.BeanRefUtil.java
com.yuninfo.videoextand.utils.DateUtil.java
com.yuninfo.videoextand.utils.FileUtil.java
com.yuninfo.videoextand.utils.HttpUtil.java
com.yuninfo.videoextand.utils.LogUtil.java
com.yuninfo.videoextand.utils.StringUtil.java
com.yuninfo.videoextand.widget.CustomPopupWindow.java
com.yuninfo.videoextand.widget.TitleBar.java
com.yuninfo.videoextand.widget.dialog.MenuDialog.java