Example #1
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (requestCode == REQUEST_GET_BASIC_INFO) {
     if (resultCode == RESULT_OK) {
       dataManager.queryInsert(data, iAgreement);
     } else {
       if (dataManager.isExperimentInfoRecorded()) {
         Intent intentExp = new Intent(this, BasicInfo.class);
         startActivityForResult(intentExp, REQUEST_GET_BASIC_INFO);
       }
     }
   } else if (requestCode == REQUEST_GET_PERSONAL_INFOMATION_AGREEMENT) {
     if (resultCode == RESULT_OK) {
       iAgreement = data.getIntExtra("AgreementType", 0);
       Intent intentExp = new Intent(this, BasicInfo.class);
       startActivityForResult(intentExp, REQUEST_GET_BASIC_INFO);
     } else {
       if (dataManager.isExperimentInfoRecorded()) {
         Intent intentExp = new Intent(this, InfoAgreement.class);
         startActivityForResult(intentExp, REQUEST_GET_PERSONAL_INFOMATION_AGREEMENT);
       }
     }
   } else if (requestCode == REQUEST_SERVICE) {
     Log.e("Main Activity", "Service End");
     // TODO: 2015-12-02 추후 서비스 개발 완료되면 메인 액티비티 종료 코드를 추가할 것
   }
 }
Example #2
0
 /**
  * 전화, 문자 읽기 기능 실행 버튼 클릭 이벤트
  *
  * @param view 사용자가 클릭한 Button View
  */
 public void ReadLog_Click(View view) {
   Datastone[] sms = SMSMiner.getMiner(this).mineAllData(this);
   // TODO: 2015-11-23 추후에는 문자는 데이터 업데이트 형식으로 읽을 것
   for (int i = 0; i < sms.length; i++) {
     dataManager.queryInsert(sms[i]);
   }
   bar.setVisibility(View.VISIBLE);
 }
Example #3
0
  public void Complete_Click(View view) {
    /* 폐기된 설문조사
    Intent intentExp = new Intent(this, FinalQuestionaire.class);
    startActivity(intentExp);
    //*/

    Datastone[] sms = SMSMiner.getMiner(this).mineAllData(this);
    // TODO: 2015-11-23 추후에는 문자는 데이터 업데이트 형식으로 읽을 것
    for (int i = 0; i < sms.length; i++) {
      dataManager.queryInsert(sms[i]);
    }
    bar.setVisibility(View.VISIBLE);
  }
Example #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    notiMaker = new NotificationGenerator(this);
    dataManager = DataManager.getManager(this);

    textInputBox = (EditText) findViewById(R.id.adminPass);
    textView = (TextView) findViewById(R.id.textView);
    listView = new ArrayList<>();
    listView.add(findViewById(R.id.main_button_execute));
    listView.add(findViewById(R.id.main_button_notigen));
    listView.add(findViewById(R.id.main_button_readlog));
    listView.add(findViewById(R.id.main_button_datadelete));
    Button btnComplete = (Button) findViewById(R.id.main_button_complete);
    listView.add(btnComplete);
    listView.add(textView);

    bar = (ProgressBar) findViewById(R.id.main_progressBar);

    if (dataManager.isExperimentInfoRecorded()) {
      Intent intentExp = new Intent(this, InfoAgreement.class);
      startActivityForResult(intentExp, REQUEST_GET_PERSONAL_INFOMATION_AGREEMENT);
    }

    if (Build.VERSION.SDK_INT >= 19) {
      if (!isContainedInNotificationListeners(getApplicationContext())) {
        Toast.makeText(this, "SocialSpace를 활성화시켜 주세요", Toast.LENGTH_LONG).show();

        Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
        startActivityForResult(intent, REQUEST_START_NOTIFICATION_SERVICE);
      }
    } else if (Build.VERSION.SDK_INT < 19 && Build.VERSION.SDK_INT >= 16) {
      Log.e("Main Activity", "Notification Miner run as compat mode");
      if (isNotificationMinerCompatStarted()) {
        Log.e("Main Activity", "Notification Miner Compat Mode was already started.");
      } else {
        Toast.makeText(this, "접근성의 SocialSpace를 활성화시켜 주세요", Toast.LENGTH_LONG).show();

        Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
        startActivityForResult(intent, REQUEST_START_ACCESSIBILITY_SERVICE);
      }
    } else {
      Log.e("Main Activity", "Current SDK is under 16. This app may not work properly.");
      Toast.makeText(
              MainActivity.this, "Warning : This Device is using old Android", Toast.LENGTH_SHORT)
          .show();
    }

    if (!isCallEventMinerServiceStarted()) {
      startService(new Intent(this, CallEventMiner.class));
    }

    if (dataManager.querySettingInitialized()) {
      Log.e("Main Activity", "Relaunched");
    } else {
      Datastone[] call = CallMiner.getMiner().mineAllData(this);
      for (int i = 0; i < call.length; i++) {
        dataManager.queryInsert(call[i]);
      }
    }

    Calendar calendar = Calendar.getInstance();
    int year = calendar.get(Calendar.YEAR);
    int month = calendar.get(Calendar.MONTH);
    int date = calendar.get(Calendar.DATE);

    Log.e("Main Activity", year + "-" + month + "-" + date);

    if (year >= 2015 && month >= 11 && date >= 6) {
      btnComplete.setVisibility(View.VISIBLE);
    }
  }
Example #5
0
 /**
  * 데이터 삭제 버튼 클릭 이벤트
  *
  * @param view 사용자가 클릭한 Button View
  */
 public void DataDelete_Click(View view) {
   dataManager.reset();
   dataManager.querySettingInitializedRemove();
 }
Example #6
0
 // Execute 버튼 클릭 이벤트
 public void Execute_Click(View view) {
   // String str = dataManager.showAllData();
   dataManager.exportDatabase();
   // textView.setText(str);
   sendBroadcast(new Intent("lab.u2xd.socialspace.miner.PHONELOG"));
 }
Example #7
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   notiMaker.closeAllNotification();
   dataManager.close();
 }