导航菜单

页面标题

页面副标题

Delta Chat v1.58.3 - QrShowActivity.java 源代码

正在查看: Delta Chat v1.58.3 应用的 QrShowActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package org.thoughtcrime.securesms.qr;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.b44t.messenger.DcContext;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.connect.DcEventCenter;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.Util;

public class QrShowActivity extends AppCompatActivity {
    static final boolean $assertionsDisabled = false;
    public static final String CHAT_ID = "chat_id";
    DcContext dcContext;
    DcEventCenter dcEventCenter;
    private final DynamicTheme dynamicTheme = new DynamicTheme();
    QrShowFragment fragment;

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.dynamicTheme.onCreate(this);
        setContentView(R.layout.activity_qr_show);
        this.fragment = (QrShowFragment) getSupportFragmentManager().findFragmentById(R.id.qrScannerFragment);
        this.dcContext = DcHelper.getContext(this);
        this.dcEventCenter = DcHelper.getEventCenter(this);
        Bundle extras = getIntent().getExtras();
        int i = extras != null ? extras.getInt("chat_id") : 0;
        ActionBar supportActionBar = getSupportActionBar();
        supportActionBar.setDisplayHomeAsUpEnabled(true);
        if (i != 0) {
            supportActionBar.setTitle(this.dcContext.getChat(i).getName());
            supportActionBar.setSubtitle(R.string.qrshow_join_group_title);
            return;
        }
        String str = DcHelper.get(this, DcHelper.CONFIG_DISPLAY_NAME);
        if (str.isEmpty()) {
            str = DcHelper.get(this, DcHelper.CONFIG_CONFIGURED_ADDRESS, "unknown");
        }
        supportActionBar.setTitle(str);
        supportActionBar.setSubtitle(R.string.qrshow_join_contact_title);
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.qr_show, menu);
        menu.findItem(R.id.new_classic_contact).setVisible(false);
        menu.findItem(R.id.paste).setVisible(false);
        menu.findItem(R.id.load_from_image).setVisible(false);
        Util.redMenuItem(menu, R.id.withdraw);
        return super.onCreateOptionsMenu(menu);
    }

    protected void onResume() {
        super.onResume();
        this.dynamicTheme.onResume(this);
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        super.onOptionsItemSelected(menuItem);
        int itemId = menuItem.getItemId();
        if (itemId == 16908332) {
            finish();
            return true;
        }
        if (itemId != R.id.withdraw) {
            return false;
        }
        this.fragment.withdrawQr();
        return false;
    }
}