102 lines
4.1 KiB
Java
102 lines
4.1 KiB
Java
package cn.com.magnity.magnitycx;
|
|
|
|
import android.app.AlertDialog;
|
|
import android.app.Dialog;
|
|
import android.os.Bundle;
|
|
import android.support.v4.app.DialogFragment;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.Button;
|
|
import android.widget.TextView;
|
|
import cn.com.magnity.magnitycx.log.Logging;
|
|
import java.util.ArrayList;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class DialogFragmentMediaInfo extends DialogFragment {
|
|
private static final String MEDIAFILEINFO = "mediaFileInfo";
|
|
private MagOnClickListener magOnClickListener_;
|
|
private ArrayList<String> mediaInfos_;
|
|
|
|
public static DialogFragmentMediaInfo newInstance(ArrayList<String> info) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putStringArrayList(MEDIAFILEINFO, info);
|
|
DialogFragmentMediaInfo dlg = new DialogFragmentMediaInfo();
|
|
dlg.setArguments(bundle);
|
|
return dlg;
|
|
}
|
|
|
|
@Override // android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
Bundle bundle = getArguments();
|
|
if (bundle != null) {
|
|
this.mediaInfos_ = bundle.getStringArrayList(MEDIAFILEINFO);
|
|
}
|
|
this.magOnClickListener_ = new MagOnClickListener();
|
|
}
|
|
|
|
private void fillCatigory(View rootView, int viewId, int stringId, String name) {
|
|
View item = rootView.findViewById(viewId);
|
|
TextView text = (TextView) item.findViewById(R.id.id_text_item_left);
|
|
text.setText(stringId);
|
|
TextView text2 = (TextView) item.findViewById(R.id.id_text_item_right);
|
|
text2.setText(name);
|
|
}
|
|
|
|
@Override // android.support.v4.app.DialogFragment
|
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
int i;
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
|
View view = inflater.inflate(R.layout.dialog_fragment_media_info, (ViewGroup) null);
|
|
Button btnOk = (Button) view.findViewById(R.id.id_btn_ok);
|
|
btnOk.setOnClickListener(this.magOnClickListener_);
|
|
try {
|
|
int i2 = 0 + 1;
|
|
try {
|
|
boolean isVideo = Integer.parseInt(this.mediaInfos_.get(0)) != 0;
|
|
int i3 = i2 + 1;
|
|
fillCatigory(view, R.id.id_media_info_name, R.string.mediaInfoName, this.mediaInfos_.get(i2));
|
|
int i4 = i3 + 1;
|
|
fillCatigory(view, R.id.id_media_info_time, R.string.mediaInfoTime, this.mediaInfos_.get(i3));
|
|
int i5 = i4 + 1;
|
|
fillCatigory(view, R.id.id_media_info_size, R.string.mediaInfoSize, this.mediaInfos_.get(i4));
|
|
if (isVideo) {
|
|
i = i5 + 1;
|
|
fillCatigory(view, R.id.id_media_info_duration, R.string.mediaInfoDuration, this.mediaInfos_.get(i5));
|
|
} else {
|
|
View item = view.findViewById(R.id.id_media_info_duration);
|
|
item.setVisibility(8);
|
|
i = i5 + 1;
|
|
}
|
|
int i6 = i + 1;
|
|
fillCatigory(view, R.id.id_media_info_resolution, R.string.mediaInfoResolution, this.mediaInfos_.get(i));
|
|
i2 = i6 + 1;
|
|
fillCatigory(view, R.id.id_media_info_path, R.string.mediaInfoPath, this.mediaInfos_.get(i6));
|
|
} catch (Exception e) {
|
|
Logging.trace("Fail to get media info");
|
|
builder.setView(view);
|
|
return builder.create();
|
|
}
|
|
} catch (Exception e2) {
|
|
}
|
|
builder.setView(view);
|
|
return builder.create();
|
|
}
|
|
|
|
private class MagOnClickListener implements View.OnClickListener {
|
|
private MagOnClickListener() {
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View v) {
|
|
switch (v.getId()) {
|
|
case R.id.id_btn_ok /* 2131624096 */:
|
|
DialogFragmentMediaInfo.this.dismiss();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|