// Path: app/src/main/java/net/fabiszewski/ulogger/Alert.java
// static AlertDialog showAlert(Activity context, CharSequence title, int layoutResource, int iconResource) {
//     @SuppressLint("InflateParams")
//     View view = context.getLayoutInflater().inflate(layoutResource, null, false);
//     AlertDialog alertDialog = new AlertDialog.Builder(context).create();
//     alertDialog.setTitle(title);
//     alertDialog.setView(view);
//     if (iconResource > 0) {
//         alertDialog.setIcon(iconResource);
//     }
//     alertDialog.show();
//     return alertDialog;
// }
// 
// Path: app/src/main/java/net/fabiszewski/ulogger/Alert.java
// static void showConfirm(Context context, CharSequence title, CharSequence message,
//                                DialogInterface.OnClickListener yesCallback) {
//     AlertDialog alertDialog = initDialog(context, title, message);
//     alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, context.getString(R.string.ok), yesCallback);
//     alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE, context.getString(R.string.cancel),
//             (dialog, which) -> dialog.dismiss());
//     alertDialog.show();
// }


import static net.fabiszewski.ulogger.Alert.showAlert;
import static net.fabiszewski.ulogger.Alert.showConfirm;
import android.Manifest;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import androidx.core.widget.TextViewCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
     * @param view View
     */
    private void uploadData(View view) {
        Context context = view.getContext();
        if (!SettingsFragment.isValidServerSetup(context)) {
            showToast(getString(R.string.provide_user_pass_url));
        } else if (DbAccess.needsSync(context)) {
            Intent syncIntent = new Intent(context, WebSyncService.class);
            context.startService(syncIntent);
            showToast(getString(R.string.uploading_started));
            isUploading = true;
        } else {
            showToast(getString(R.string.nothing_to_synchronize));
        }
    }

    /**
     * Called when the user clicks the track text view
     * @param view View
     */
    private void trackSummary(View view) {
        Context context = view.getContext();
        final TrackSummary summary = DbAccess.getTrackSummary(context);
        if (summary == null) {
            showToast(getString(R.string.no_positions));
            return;
        }

        MainActivity activity = (MainActivity) getActivity();
        if (activity != null) {
// Path: app/src/main/java/net/fabiszewski/ulogger/Alert.java
// static AlertDialog showAlert(Activity context, CharSequence title, int layoutResource, int iconResource) {
//     @SuppressLint("InflateParams")
//     View view = context.getLayoutInflater().inflate(layoutResource, null, false);
//     AlertDialog alertDialog = new AlertDialog.Builder(context).create();
//     alertDialog.setTitle(title);
//     alertDialog.setView(view);
//     if (iconResource > 0) {
//         alertDialog.setIcon(iconResource);
//     }
//     alertDialog.show();
//     return alertDialog;
// }
// 
// Path: app/src/main/java/net/fabiszewski/ulogger/Alert.java
// static void showConfirm(Context context, CharSequence title, CharSequence message,
//                                DialogInterface.OnClickListener yesCallback) {
//     AlertDialog alertDialog = initDialog(context, title, message);
//     alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, context.getString(R.string.ok), yesCallback);
//     alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE, context.getString(R.string.cancel),
//             (dialog, which) -> dialog.dismiss());
//     alertDialog.show();
// }


// Path: app/src/main/java/net/fabiszewski/ulogger/MainFragment.java
import static net.fabiszewski.ulogger.Alert.showAlert;
import static net.fabiszewski.ulogger.Alert.showConfirm;
import android.Manifest;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import androidx.core.widget.TextViewCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

     * @param view View
     */
    private void uploadData(View view) {
        Context context = view.getContext();
        if (!SettingsFragment.isValidServerSetup(context)) {
            showToast(getString(R.string.provide_user_pass_url));
        } else if (DbAccess.needsSync(context)) {
            Intent syncIntent = new Intent(context, WebSyncService.class);
            context.startService(syncIntent);
            showToast(getString(R.string.uploading_started));
            isUploading = true;
        } else {
            showToast(getString(R.string.nothing_to_synchronize));
        }
    }

    /**
     * Called when the user clicks the track text view
     * @param view View
     */
    private void trackSummary(View view) {
        Context context = view.getContext();
        final TrackSummary summary = DbAccess.getTrackSummary(context);
        if (summary == null) {
            showToast(getString(R.string.no_positions));
            return;
        }

        MainActivity activity = (MainActivity) getActivity();
        if (activity != null) {
            final AlertDialog dialog = showAlert(activity,