正在查看: Delta Chat v1.58.3 应用的 LogViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Delta Chat v1.58.3 应用的 LogViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.thoughtcrime.securesms;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentTransaction;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.util.FileProviderUtil;
public class LogViewActivity extends BaseActionBarActivity {
private static final String TAG = "LogViewActivity";
LogViewFragment logViewFragment;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.log_view_activity);
this.logViewFragment = new LogViewFragment();
FragmentTransaction beginTransaction = getSupportFragmentManager().beginTransaction();
beginTransaction.replace(R.id.fragment_container, this.logViewFragment);
beginTransaction.commit();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
public boolean onPrepareOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menu.clear();
menuInflater.inflate(R.menu.view_log, menu);
super.onPrepareOptionsMenu(menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
super.onOptionsItemSelected(menuItem);
int itemId = menuItem.getItemId();
if (itemId == 16908332) {
finish();
return true;
}
if (itemId == R.id.save_log) {
Permissions.with((Activity) this).request("android.permission.WRITE_EXTERNAL_STORAGE").alwaysGrantOnSdk30().ifNecessary().onAllGranted(new Runnable() {
@Override
public final void run() {
LogViewActivity.this.m1249xcf3c438a();
}
}).execute();
return true;
}
if (itemId == R.id.share_log) {
shareLog();
return true;
}
if (itemId == R.id.log_zoom_in) {
this.logViewFragment.setLogTextSize(Float.valueOf(this.logViewFragment.getLogTextSize().floatValue() + 2.0f));
return false;
}
if (itemId == R.id.log_zoom_out) {
this.logViewFragment.setLogTextSize(Float.valueOf(this.logViewFragment.getLogTextSize().floatValue() - 2.0f));
return false;
}
if (itemId == R.id.log_scroll_down) {
this.logViewFragment.scrollDownLog();
return false;
}
if (itemId == R.id.log_scroll_up) {
this.logViewFragment.scrollUpLog();
}
return false;
}
void m1249xcf3c438a() {
new AlertDialog.Builder(this).setMessage(this.logViewFragment.saveLogFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)) != null ? R.string.pref_saved_log : R.string.pref_save_log_failed).setPositiveButton(android.R.string.ok, (DialogInterface.OnClickListener) null).show();
}
public void shareLog() {
try {
Uri uriFor = FileProviderUtil.getUriFor(this, this.logViewFragment.saveLogFile(getExternalCacheDir()));
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("text/plain");
intent.putExtra("android.intent.extra.STREAM", uriFor);
intent.addFlags(1);
startActivity(Intent.createChooser(intent, getString(R.string.chat_share_with_title)));
} catch (Exception e) {
Log.e(TAG, "failed to share log", e);
}
}
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
Permissions.onRequestPermissionsResult((Activity) this, i, strArr, iArr);
}
}