导航菜单

页面标题

页面副标题

St.John's v1.0.9 - DetailEventActivity.java 源代码

正在查看: St.John's v1.0.9 应用的 DetailEventActivity.java JAVA 源代码文件

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


package com.mcb.stjohnsemschool.activity;

import android.content.Intent;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.mcb.stjohnsemschool.adapter.DetailAdapter;
import com.mcb.stjohnsemschool.model.FilePathModelClass;
import com.mcb.stjohnsemschool.utils.ExpandedListViewCustom;
import com.mcb.stjohnsemschool.utils.Utility;
import java.util.ArrayList;
import java.util.Iterator;

public class DetailEventActivity extends BaseActivity {
    public static ArrayList<FilePathModelClass> mFilePathList = new ArrayList<>();
    private String className;
    private String createdDate;
    private String displayFileName = "";
    private String eventName;
    private String filepath;
    private Typeface fontMuseo;
    TextView mClassText;
    TextView mHeadingText;
    ExpandedListViewCustom mListViewFilePath;

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_events_detail);
        getSupportActionBar().setTitle("Event Calendar");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowTitleEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
        setUpIds();
        this.className = getIntent().getExtras().getString("className");
        this.eventName = getIntent().getExtras().getString("eventName");
        this.createdDate = getIntent().getExtras().getString("createdDate");
        this.filepath = getIntent().getExtras().getString("filepath");
        this.displayFileName = getIntent().getExtras().getString("DisplayFileName");
        getIntent().getExtras().getString(TtmlNode.ATTR_ID);
        if (Build.VERSION.SDK_INT >= 23) {
            getMultiplePermissions();
        }
        getFileDetails();
        this.mHeadingText.setText(Utility.fromHtml(this.eventName));
        this.mClassText.setText(Utility.fromHtml(this.className));
    }

    private void setUpIds() {
        this.mHeadingText = (TextView) findViewById(R.id.event_heading_detail);
        this.mClassText = (TextView) findViewById(R.id.event_class);
        this.mHeadingText.setTypeface(this.fontMuseo);
        this.mClassText.setTypeface(this.fontMuseo);
        this.mListViewFilePath = findViewById(R.id.listview_event_filepath);
    }

    public void getFileDetails() {
        mFilePathList.clear();
        String str = this.filepath;
        if (str != null && str.trim().length() > 0) {
            String replace = this.filepath.replace("\\", "/");
            this.filepath = replace;
            String replace2 = replace.replace(" ", "%20");
            this.filepath = replace2;
            String substring = replace2.substring(replace2.lastIndexOf("/") + 1);
            FilePathModelClass filePathModelClass = new FilePathModelClass();
            filePathModelClass.setFileName(substring);
            filePathModelClass.setFilePath(this.filepath);
            filePathModelClass.setDisplayFileName(this.displayFileName);
            mFilePathList.add(filePathModelClass);
        }
        if (mFilePathList.size() > 0) {
            this.mListViewFilePath.setAdapter(new DetailAdapter(this, this, mFilePathList, "EventCalendar"));
        }
    }

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (keyEvent.getKeyCode() != 4 || keyEvent.getAction() != 0) {
            return false;
        }
        setResult(565, new Intent());
        finish();
        overridePendingTransition(R.anim.left_in, R.anim.right_out);
        return true;
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.share_menu, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == 16908332) {
            super.onBackPressed();
            return true;
        }
        if (menuItem.getItemId() == 2131361887) {
            try {
                String str = getResources().getString(R.string.playstore_url) + getApplicationContext().getPackageName();
                Intent intent = new Intent("android.intent.action.SEND");
                intent.putExtra("android.intent.extra.TEXT", "\nUsing MyClassboard :St Johns EM High School Parent Portal Mobile App\n" + this.className + "\n" + this.createdDate + "\n" + this.eventName + "\n" + this.filepath + "\napp available at\n" + str);
                intent.setType("text/plain");
                intent.putExtra("android.intent.extra.SUBJECT", "Using MyClassboard :St Johns EM High School Parent Portal Mobile App ");
                startActivity(Intent.createChooser(intent, "Share via..."));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return super.onOptionsItemSelected(menuItem);
    }

    protected void onPause() {
        resetVideos();
        super.onPause();
    }

    protected void onDestroy() {
        releaseVideos();
        super.onDestroy();
    }

    private void resetVideos() {
        Iterator<FilePathModelClass> it = mFilePathList.iterator();
        while (it.hasNext()) {
            FilePathModelClass next = it.next();
            if (next.getPlayerView() != null && next.getPlayerView().getPlayer() != null) {
                next.getPlayerView().getPlayer().setPlayWhenReady(false);
                next.getDownloadImage().setVisibility(0);
                next.getImage().setVisibility(0);
                next.getVideoView().setVisibility(8);
                next.getPlayerView().setVisibility(8);
            }
        }
    }

    private void releaseVideos() {
        Iterator<FilePathModelClass> it = mFilePathList.iterator();
        while (it.hasNext()) {
            FilePathModelClass next = it.next();
            if (next.getPlayerView() != null && next.getPlayerView().getPlayer() != null) {
                next.getPlayerView().getPlayer().release();
                next.getDownloadImage().setVisibility(0);
                next.getImage().setVisibility(0);
                next.getVideoView().setVisibility(8);
                next.getPlayerView().setVisibility(8);
            }
        }
    }

    protected void onResume() {
        super.onResume();
        String string = getSharedPreferences("", 0).getString("usernamekey", "");
        Bundle bundle = new Bundle();
        bundle.putString("user_name", string);
        FirebaseAnalytics.getInstance(this).logEvent("PAGE_DETAIL_EVENT", bundle);
    }
}