<commit_before>package meizhuo.org.lightmeeting.acty;






import java.io.File;
import java.util.ArrayList;
import java.util.List;


import butterknife.InjectView;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.app.DownloadManager.Request;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnKeyListener;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.webkit.MimeTypeMap;
import meizhuo.org.lightmeeting.R;
import meizhuo.org.lightmeeting.app.BaseActivity;
import meizhuo.org.lightmeeting.app.CoreService;
import meizhuo.org.lightmeeting.fragment.DrawerMain;
import meizhuo.org.lightmeeting.fragment.LMList_fm;
import meizhuo.org.lightmeeting.model.KV;
import meizhuo.org.lightmeeting.utils.AndroidUtils;
import meizhuo.org.lightmeeting.utils.Constants;

public class MainActivity extends BaseActivity { 
	
	
	private BroadcastReceiver mReceiver = null;
	private String DefaultTitle = "轻会议";
	private String MenuTitle = "菜单";
	//获取Fragment的管理员权限
	private FragmentManager manager = getSupportFragmentManager();
	@InjectView(R.id.drawer_layout) DrawerLayout mDrawerLayout;
	private ActionBarDrawerToggle mDrawerToggle;
	private ActionBar mActionBar;
	private DownloadManager downloadManager;
	private SharedPreferences prefs;
	private static final String DL_ID = "downloadId";
	

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState,R.layout.activity_main);
		initDownload();
		checkVersion();
		initReceiver();
	
		initLayout();
		
	}
	


	@Override
	protected void initData() {
		// TODO Auto-generated method stub
		
	}
	
	private void initDownload() {
		downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
		prefs = PreferenceManager.getDefaultSharedPreferences(this);
	}

	@Override
	protected void initLayout() {
		// TODO Auto-generated method stub
		mDrawerLayout.setDrawerListener(new MyDrawerListener());
		mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
		mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.lm_ic_drawer_white, 
				R.string.drawer_open, R.string.drawer_close);
		//init the actionbar to Display
		mActionBar = getActionBar();
		//决定左上角是否可以点击
		mActionBar.setDisplayHomeAsUpEnabled(true);
		setActionBarTitle(DefaultTitle);
		manager.beginTransaction().add(R.id.container, new LMList_fm(),"LMList_fm").commit();
		manager.beginTransaction().add(R.id.left_container, new DrawerMain(),"DrawerMain").commit();
	}
	
	public void setMainContent(Fragment fragment)
	{
		mDrawerLayout.closeDrawers();
		//activity 的后退栈中弹出fragment们(这可以模拟后退键引发的动作)
		getSupportFragmentManager().popBackStack();
		//回退之后切换原来的界面
		getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
		
	}
	
	private void setActionBarTitle(String title){
		mActionBar.setTitle(title);
	}
	
	@Override
		protected void onPause() {
			// TODO Auto-generated method stub
			super.onPause();
			mDrawerLayout.closeDrawers();
		}
	
	@Override
		protected void onPostCreate(Bundle savedInstanceState) {
			// TODO Auto-generated method stub
			super.onPostCreate(savedInstanceState);<commit_msg>Fix:MainActivity 没有释放BroadcastRecevier<commit_after>package meizhuo.org.lightmeeting.acty;






import java.io.File;
import java.util.ArrayList;
import java.util.List;


import butterknife.InjectView;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.app.DownloadManager.Request;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnKeyListener;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.webkit.MimeTypeMap;
import meizhuo.org.lightmeeting.R;
import meizhuo.org.lightmeeting.app.BaseActivity;
import meizhuo.org.lightmeeting.app.CoreService;
import meizhuo.org.lightmeeting.fragment.DrawerMain;
import meizhuo.org.lightmeeting.fragment.LMList_fm;
import meizhuo.org.lightmeeting.model.KV;
import meizhuo.org.lightmeeting.utils.AndroidUtils;
import meizhuo.org.lightmeeting.utils.Constants;

public class MainActivity extends BaseActivity { 
	
	
	private BroadcastReceiver mReceiver = null;
	private String DefaultTitle = "轻会议";
	private String MenuTitle = "菜单";
	//获取Fragment的管理员权限
	private FragmentManager manager = getSupportFragmentManager();
	@InjectView(R.id.drawer_layout) DrawerLayout mDrawerLayout;
	private ActionBarDrawerToggle mDrawerToggle;
	private ActionBar mActionBar;
	private DownloadManager downloadManager;
	private SharedPreferences prefs;
	private static final String DL_ID = "downloadId";
	

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState,R.layout.activity_main);
		initDownload();
		checkVersion();
		initReceiver();
	
		initLayout();
		
	}
	


	@Override
	protected void initData() {
		// TODO Auto-generated method stub
		
	}
	
	private void initDownload() {
		downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
		prefs = PreferenceManager.getDefaultSharedPreferences(this);
	}

	@Override
	protected void initLayout() {
		// TODO Auto-generated method stub
		mDrawerLayout.setDrawerListener(new MyDrawerListener());
		mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
		mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.lm_ic_drawer_white, 
				R.string.drawer_open, R.string.drawer_close);
		//init the actionbar to Display
		mActionBar = getActionBar();
		//决定左上角是否可以点击
		mActionBar.setDisplayHomeAsUpEnabled(true);
		setActionBarTitle(DefaultTitle);
		manager.beginTransaction().add(R.id.container, new LMList_fm(),"LMList_fm").commit();
		manager.beginTransaction().add(R.id.left_container, new DrawerMain(),"DrawerMain").commit();
	}
	
	public void setMainContent(Fragment fragment)
	{
		mDrawerLayout.closeDrawers();
		//activity 的后退栈中弹出fragment们(这可以模拟后退键引发的动作)
		getSupportFragmentManager().popBackStack();
		//回退之后切换原来的界面
		getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
		
	}
	
	private void setActionBarTitle(String title){
		mActionBar.setTitle(title);
	}
	
	@Override
		protected void onPause() {
			// TODO Auto-generated method stub
			super.onPause();
			mDrawerLayout.closeDrawers();
		}
	
	@Override protected void onDestroy() {
		super.onDestroy();
		if(mReceiver != null){
			unregisterReceiver(mReceiver);
		}
	}
	
	@Override
		protected void onPostCreate(Bundle savedInstanceState) {
			// TODO Auto-generated method stub
			super.onPostCreate(savedInstanceState);
{'fraction_non_alphanumeric': 0.09803206997084549, 'fraction_numerical': 0.0012147716229348883, 'mean_word_length': 5.906879194630872, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3102590', 'n_tokens_mistral': 2689, 'n_tokens_neox': 2561, 'n_words': 460}