Пример #1
0
    @Override
    public void onLongPress(MotionEvent event) {
      if (!QuranFileUtils.haveAyaPositionFile(getActivity())
          || !QuranFileUtils.hasArabicSearchDatabase(getActivity())) {
        Activity activity = getActivity();
        if (activity != null) {
          PagerActivity pagerActivity = (PagerActivity) activity;
          pagerActivity.showGetRequiredFilesDialog();
          return;
        }
      }

      if (mCoordinateData == null) {
        mCurrentTask = new QueryAyahCoordsTask(event).execute();
      } else {
        handleLongPress(event);
      }
    }
Пример #2
0
 private boolean checkCoordinateData(MotionEvent event, EventType eventType) {
   // Check files downloaded
   if (!QuranFileUtils.haveAyaPositionFile(getActivity())
       || !QuranFileUtils.hasArabicSearchDatabase(getActivity())) {
     Activity activity = getActivity();
     if (activity != null) {
       PagerActivity pagerActivity = (PagerActivity) activity;
       pagerActivity.showGetRequiredFilesDialog();
       return false;
     }
   }
   // Check we fetched the data
   if (mCoordinatesData == null) {
     mCurrentTask = new GetAyahCoordsTask(getActivity(), event, eventType).execute(pageNumber);
     return false;
   }
   // All good
   return true;
 }
    @Override
    protected void onPostExecute(String logs) {
      if (mIsPaused) {
        return;
      }

      Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
      emailIntent.setType("plain/text");

      QuranScreenInfo qsi;
      String body = "\n\n";
      try {
        PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        body = pInfo.packageName + " Version: " + pInfo.versionName;
      } catch (Exception e) {
      }

      try {
        body += "\nPhone: " + android.os.Build.MANUFACTURER + " " + android.os.Build.MODEL;
        body +=
            "\nAndroid Version: "
                + android.os.Build.VERSION.CODENAME
                + " "
                + android.os.Build.VERSION.RELEASE;

        qsi = QuranScreenInfo.getOrMakeInstance(QuranPreferenceActivity.this);
        body += "\nDisplay: " + qsi.getWidthParam();
        if (qsi.isTablet(QuranPreferenceActivity.this)) {
          body += ", tablet width: " + qsi.getWidthParam();
        }
        body += "\n";
        body += "max bitmap height: " + qsi.getBitmapMaxHeight() + "\n";

        if (QuranFileUtils.haveAllImages(QuranPreferenceActivity.this, qsi.getWidthParam())) {
          body += "all images found for " + qsi.getWidthParam() + "\n";
        }

        if (qsi.isTablet(QuranPreferenceActivity.this)
            && QuranFileUtils.haveAllImages(
                QuranPreferenceActivity.this, qsi.getTabletWidthParam())) {
          body += "all tablet images found for " + qsi.getTabletWidthParam() + "\n";
        }
      } catch (Exception e) {
      }

      int memClass =
          ((ActivityManager)
                  QuranPreferenceActivity.this.getSystemService(Context.ACTIVITY_SERVICE))
              .getMemoryClass();
      body += "memory class: " + memClass + "\n\n";

      body += "\n\n";
      body += "\nLogs: " + logs;
      body += "\n\n";

      emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
      emailIntent.putExtra(
          android.content.Intent.EXTRA_SUBJECT, getString(R.string.email_logs_subject));
      emailIntent.putExtra(
          android.content.Intent.EXTRA_EMAIL, new String[] {getString(R.string.email_to)});
      startActivity(Intent.createChooser(emailIntent, getString(R.string.send_email)));
    }
 @Override
 protected Void doInBackground(Void... voids) {
   mAppSize = QuranFileUtils.getAppUsedSpace(QuranPreferenceActivity.this);
   return null;
 }
 @Override
 protected Boolean doInBackground(Void... voids) {
   return QuranFileUtils.moveAppFiles(QuranPreferenceActivity.this, newLocation);
 }