| | |
| | | import android.support.v4.content.Loader; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.RadioButton; |
| | | import android.widget.RadioGroup; |
| | | import android.widget.TextView; |
| | |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.db.MessageTable; |
| | | import com.weikou.beibeivideo.entity.NewComment; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.baidu.BaiDuNewsFragment; |
| | | import com.weikou.beibeivideo.ui.baidu.BaiDuVideosFragment; |
| | | import com.weikou.beibeivideo.ui.login.LoginActivity; |
| | | import com.weikou.beibeivideo.ui.login.PersonInfoActivity; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity2; |
| | | import com.weikou.beibeivideo.ui.mine.BrowserActivity; |
| | | import com.weikou.beibeivideo.ui.mine.SystemMessageActivity; |
| | | import com.weikou.beibeivideo.ui.mine.WatchHistoryActivity; |
| | | import com.weikou.beibeivideo.ui.push.PushOpenClickActivity; |
| | | import com.weikou.beibeivideo.ui.recommend.SearchActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.ExitDialog; |
| | | import com.weikou.beibeivideo.util.LoginFirstDialog; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | import com.weikou.beibeivideo.util.ad.manager.SearchResultAdManager; |
| | | import com.yeshi.appupdate.AppUpdate; |
| | | |
| | |
| | | |
| | | exitDialog = exitDialogBuilder.create(); |
| | | exitDialog.setCanceledOnTouchOutside(true); |
| | | /* |
| | | * 计算状态栏高度并设置 |
| | | */ |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | Window window = getWindow(); |
| | | window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, |
| | | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); |
| | | int result = 0; |
| | | int resourceId = getResources().getIdentifier("status_bar_height", |
| | | "dimen", "android"); |
| | | if (resourceId > 0) { |
| | | result = getResources().getDimensionPixelSize(resourceId); |
| | | } |
| | | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, |
| | | result); |
| | | findViewById(R.id.v_status_bar).setLayoutParams(params); |
| | | findViewById(R.id.v_status_bar).setVisibility(View.VISIBLE); |
| | | } else { |
| | | findViewById(R.id.v_status_bar).setVisibility(View.GONE); |
| | | } |
| | | initStatusBar(); |
| | | // 将imei mac lat lng存入sharedpreference中 |
| | | SharedPreferences mPre = getSharedPreferences("user", |
| | | Context.MODE_PRIVATE); |
| | | WifiManager wifi = (WifiManager) this.getApplicationContext().getSystemService(Context.WIFI_SERVICE); |
| | | WifiInfo info = wifi.getConnectionInfo(); |
| | | |
| | | Editor editor = mPre.edit(); |
| | | if (StringUtils.isEmpty(getMacAddress())) { |
| | | editor.putString("mac", info.getMacAddress()); |
| | | } else { |
| | | editor.putString("mac", getMacAddress()); |
| | | } |
| | | editor.commit(); |
| | | try { |
| | | Editor editor = mPre.edit(); |
| | | if (StringUtils.isEmpty(getMacAddress())) { |
| | | editor.putString("mac", info.getMacAddress()); |
| | | } else { |
| | | editor.putString("mac", getMacAddress()); |
| | | } |
| | | editor.commit(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | tv_search = findViewById(R.id.tv_activity_main_search); |
| | | |
| | | iv_msg_dot = findViewById(R.id.iv_msg_dot); |
| | |
| | | iv_taobao.setOnClickListener(this); |
| | | iv_red_dot = findViewById(R.id.iv_red_dot); |
| | | fl_right_ad = findViewById(R.id.fl_right_ad); |
| | | |
| | | /* |
| | | * 计算状态栏高度并设置 |
| | | */ |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | Window window = getWindow(); |
| | | window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, |
| | | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); |
| | | int result = 0; |
| | | int resourceId = getResources().getIdentifier("status_bar_height", |
| | | "dimen", "android"); |
| | | if (resourceId > 0) { |
| | | result = getResources().getDimensionPixelSize(resourceId); |
| | | } |
| | | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, |
| | | result); |
| | | findViewById(R.id.v_status_bar).setLayoutParams(params); |
| | | } else { |
| | | findViewById(R.id.v_status_bar).setVisibility(View.GONE); |
| | | } |
| | | initStatusBar(); |
| | | |
| | | initialer.run(); |
| | | |
| | |
| | | }); |
| | | setRightTopAD(); |
| | | preLoadCommonAD(); |
| | | |
| | | |
| | | if (BeibeiConstant.IS_TEST) { |
| | | tv_search.postDelayed(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | VideoInfo videoInfo = new VideoInfo(); |
| | | videoInfo.setId("8065880"); |
| | | videoInfo.setThirdType("0"); |
| | | Intent intent = new Intent(MainActivity.this, VideoDetailActivity2.class); |
| | | intent.putExtra("video_info", videoInfo); |
| | | startActivity(intent); |
| | | } |
| | | }, 2000); |
| | | } |
| | | |
| | | //拉取详情问题 |
| | | UserUtil.updateUserInfo(getApplicationContext(), null); |
| | | } |
| | | |
| | | |
| | |
| | | addDownloadBuxin(preferences.getString("shopurl", "")); |
| | | } |
| | | EventBus.getDefault().register(this); |
| | | |
| | | PushOpenClickActivity.resumeJumpActivity(this); |
| | | } |
| | | |
| | | |