2021-07-24 02:37:17 +00:00
|
|
|
package c.b.a.f;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Environment;
|
|
|
|
import androidx.core.content.FileProvider;
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.lytefast.flexinput.R;
|
|
|
|
import com.lytefast.flexinput.managers.FileManager;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.io.File;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Locale;
|
|
|
|
/* compiled from: SimpleFileManager.kt */
|
|
|
|
public class b implements FileManager {
|
|
|
|
public final Context a;
|
|
|
|
public final String b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-28 07:39:21 +00:00
|
|
|
public final String f250c;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
public b(Context context, String str, String str2, int i) {
|
|
|
|
String str3;
|
|
|
|
String str4 = null;
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
str3 = context.getPackageName() + ".file-provider";
|
|
|
|
} else {
|
|
|
|
str3 = null;
|
|
|
|
}
|
|
|
|
if ((i & 4) != 0) {
|
|
|
|
str4 = context.getString(R.g.discord);
|
|
|
|
m.checkNotNullExpressionValue(str4, "context.getString(R.string.discord)");
|
|
|
|
}
|
|
|
|
m.checkNotNullParameter(context, "context");
|
|
|
|
m.checkNotNullParameter(str3, "providerAuthority");
|
|
|
|
m.checkNotNullParameter(str4, "imageDirName");
|
|
|
|
this.a = context;
|
|
|
|
this.b = str3;
|
2021-07-28 07:39:21 +00:00
|
|
|
this.f250c = str4;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.lytefast.flexinput.managers.FileManager
|
|
|
|
public Uri a(Context context, File file) {
|
|
|
|
m.checkNotNullParameter(context, "context");
|
|
|
|
m.checkNotNullParameter(file, "file");
|
|
|
|
Uri uriForFile = FileProvider.getUriForFile(context, this.b, file);
|
|
|
|
m.checkNotNullExpressionValue(uriForFile, "FileProvider.getUriForFi… providerAuthority, file)");
|
|
|
|
return uriForFile;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.lytefast.flexinput.managers.FileManager
|
|
|
|
public File b() {
|
|
|
|
String format = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
|
|
|
|
Context context = this.a;
|
2021-07-28 07:39:21 +00:00
|
|
|
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), this.f250c);
|
2021-07-24 02:37:17 +00:00
|
|
|
file.mkdirs();
|
|
|
|
if (!file.exists()) {
|
|
|
|
file = context.getFilesDir();
|
|
|
|
m.checkNotNullExpressionValue(file, "context.filesDir");
|
|
|
|
}
|
|
|
|
return new File(file, a.s(format, ".jpg"));
|
|
|
|
}
|
|
|
|
}
|