mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 23:59:21 -04:00
Refactor ConsoleFragment.java
This commit is contained in:
parent
6fe447410c
commit
668b49eeb8
@ -2,6 +2,7 @@ package net.kdt.pojavlaunch.fragments;
|
||||
|
||||
import android.os.*;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
@ -12,34 +13,33 @@ import android.graphics.*;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
public class ConsoleFragment extends Fragment
|
||||
{
|
||||
public TextView consoleView;
|
||||
public class ConsoleFragment extends Fragment {
|
||||
public TextView mConsoleView;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.lmaintab_consolelog, container, false);
|
||||
|
||||
consoleView = (TextView) view.findViewById(R.id.lmaintabconsoleLogTextView);
|
||||
consoleView.setTypeface(Typeface.MONOSPACE);
|
||||
consoleView.setHint(this.getText(R.string.main_nolog));
|
||||
mConsoleView = (TextView) view.findViewById(R.id.lmaintabconsoleLogTextView);
|
||||
mConsoleView.setTypeface(Typeface.MONOSPACE);
|
||||
mConsoleView.setHint(this.getText(R.string.main_nolog));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
consoleView = (TextView) getView().findViewById(R.id.lmaintabconsoleLogTextView);
|
||||
mConsoleView = (TextView) getView().findViewById(R.id.lmaintabconsoleLogTextView);
|
||||
}
|
||||
|
||||
public void putLog(String str) {
|
||||
if (consoleView == null) {
|
||||
consoleView = (TextView) getView().findViewById(R.id.lmaintabconsoleLogTextView);
|
||||
if (mConsoleView == null) {
|
||||
mConsoleView = (TextView) getView().findViewById(R.id.lmaintabconsoleLogTextView);
|
||||
}
|
||||
|
||||
consoleView.append(str);
|
||||
mConsoleView.append(str);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user