Search in sources :

Example 1 with DeviceFragment

use of com.secupwn.aimsicd.ui.fragments.DeviceFragment in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    deviceFragment = new DeviceFragment();
    cellInfoFragment = new CellInfoFragment();
    atCommandFragment = new AtCommandFragment();
    dbViewerFragment = new DbViewerFragment();
    mapFragment = new MapFragment();
    mNavConf = new DrawerMenuActivityConfiguration.Builder(this).build();
    mDrawerLayout = (DrawerLayout) findViewById(mNavConf.getDrawerLayoutId());
    mDrawerList = (ListView) findViewById(mNavConf.getLeftDrawerId());
    mActionBar = getSupportActionBar();
    mTitle = getTitle();
    mDrawerTitle = getTitle();
    mDrawerList.setAdapter(mNavConf.getBaseAdapter());
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
    mDrawerLayout, /* DrawerLayout object */
    R.string.drawer_open, /* "open drawer" description */
    R.string.drawer_close) {

        /* "close drawer" description */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            mActionBar.setTitle(mTitle);
            invalidateOptionsMenu();
        }

        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            mActionBar.setTitle(mDrawerTitle);
            invalidateOptionsMenu();
        }
    };
    // Set the drawer toggle as the DrawerListener
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mActionBar.setDisplayHomeAsUpEnabled(true);
    mActionBar.setHomeButtonEnabled(true);
    prefs = getSharedPreferences(AimsicdService.SHARED_PREFERENCES_BASENAME, 0);
    /* Pref listener to enable sms detection on pref change   */
    prefListener = new SharedPreferences.OnSharedPreferenceChangeListener() {

        public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
            if (key.equals(getString(R.string.adv_user_root_pref_key))) {
                SmsDetection();
            }
        }
    };
    prefs.registerOnSharedPreferenceChangeListener(prefListener);
    mDisclaimerAccepted = getResources().getString(R.string.disclaimer_accepted);
    if (!prefs.getBoolean(mDisclaimerAccepted, false)) {
        final AlertDialog.Builder disclaimer = new AlertDialog.Builder(this).setTitle(R.string.disclaimer_title).setMessage(R.string.disclaimer).setPositiveButton(R.string.text_agree, new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {
                prefsEditor = prefs.edit();
                prefsEditor.putBoolean(mDisclaimerAccepted, true);
                prefsEditor.apply();
                startService();
            }
        }).setNegativeButton(R.string.text_disagree, new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {
                prefsEditor = prefs.edit();
                prefsEditor.putBoolean(mDisclaimerAccepted, false);
                prefsEditor.apply();
                Uri packageUri = Uri.parse("package:com.SecUpwN.AIMSICD");
                Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri);
                startActivity(uninstallIntent);
                finish();
                if (mAimsicdService != null) {
                    mAimsicdService.onDestroy();
                }
            }
        });
        AlertDialog disclaimerAlert = disclaimer.create();
        disclaimerAlert.show();
    } else {
        startService();
    }
}
Also used : AlertDialog(android.app.AlertDialog) AtCommandFragment(com.secupwn.aimsicd.ui.fragments.AtCommandFragment) SharedPreferences(android.content.SharedPreferences) DialogInterface(android.content.DialogInterface) MapFragment(com.secupwn.aimsicd.ui.fragments.MapFragment) DeviceFragment(com.secupwn.aimsicd.ui.fragments.DeviceFragment) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Uri(android.net.Uri) CellInfoFragment(com.secupwn.aimsicd.ui.fragments.CellInfoFragment) DbViewerFragment(com.secupwn.aimsicd.ui.fragments.DbViewerFragment)

Aggregations

AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Uri (android.net.Uri)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 AtCommandFragment (com.secupwn.aimsicd.ui.fragments.AtCommandFragment)1 CellInfoFragment (com.secupwn.aimsicd.ui.fragments.CellInfoFragment)1 DbViewerFragment (com.secupwn.aimsicd.ui.fragments.DbViewerFragment)1 DeviceFragment (com.secupwn.aimsicd.ui.fragments.DeviceFragment)1 MapFragment (com.secupwn.aimsicd.ui.fragments.MapFragment)1