huge code-cleanup
This commit is contained in:
parent
5c4c96357d
commit
3961a880f1
@ -86,10 +86,6 @@ public class AddButtonDialogSingle extends DialogFragment {
|
||||
{
|
||||
this.frag = frag;
|
||||
}
|
||||
public TabsFragment getFragment()
|
||||
{
|
||||
return frag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NotNull Context context) {
|
||||
|
@ -80,10 +80,6 @@ public class AddButtonsDialogDouble extends DialogFragment {
|
||||
this.frag = frag;
|
||||
}
|
||||
|
||||
public TabsFragment getFragment() {
|
||||
return frag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NotNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
@ -8,7 +8,6 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
@ -23,7 +22,7 @@ public class AddHeadlineDialog extends DialogFragment {
|
||||
|
||||
private EditText editText_name;
|
||||
private TabsFragment frag;
|
||||
ImageView delete;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param savedInstanceState
|
||||
@ -77,10 +76,6 @@ public class AddHeadlineDialog extends DialogFragment {
|
||||
{
|
||||
this.frag = frag;
|
||||
}
|
||||
public TabsFragment getFragment()
|
||||
{
|
||||
return frag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NotNull Context context) {
|
||||
|
@ -6,13 +6,10 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.navigation.ui.AppBarConfiguration;
|
||||
|
||||
public class IntroActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
private AppBarConfiguration mAppBarConfiguration;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -13,7 +13,6 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.media.MediaPlayer;
|
||||
@ -599,14 +598,5 @@ public class MainActivity extends AppCompatActivity {
|
||||
return dest;
|
||||
}
|
||||
|
||||
public static Bitmap createImage(int width, int height, int color) {
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(color);
|
||||
canvas.drawRect(0F, 0F, (float) width, (float) height, paint);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -122,10 +122,6 @@ public class MovableFloatingActionButton extends FloatingActionButton implements
|
||||
|
||||
}
|
||||
|
||||
public void setCustomClickListener(CustomClickListener customClickListener) {
|
||||
this.customClickListener = customClickListener;
|
||||
}
|
||||
|
||||
public interface CustomClickListener {
|
||||
void onClick(View view);
|
||||
}
|
||||
|
@ -13,19 +13,16 @@ import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import de.jg_cody.Teraplex.MainActivity;
|
||||
import de.jg_cody.Teraplex.R;
|
||||
|
||||
public class CreditsFragment extends Fragment {
|
||||
|
||||
private CreditsViewModel creditsViewModel;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
creditsViewModel =
|
||||
new ViewModelProvider(this).get(CreditsViewModel.class);
|
||||
|
||||
View root = inflater.inflate(R.layout.fragment_credits, container, false);
|
||||
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||
String Background = p.getString("Background", null);
|
||||
|
@ -1,8 +0,0 @@
|
||||
package de.jg_cody.Teraplex.ui.credits;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class CreditsViewModel extends ViewModel {
|
||||
|
||||
|
||||
}
|
@ -26,7 +26,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.jcraft.jsch.Channel;
|
||||
import com.jcraft.jsch.JSch;
|
||||
@ -51,15 +50,10 @@ public class HomeFragment extends Fragment {
|
||||
Button shutdown_Button;
|
||||
Button loginButton;
|
||||
Button logoutButton;
|
||||
Terminal terminal;
|
||||
Button wlan_aus_Button;
|
||||
Button wlan_an_Button;
|
||||
Button kodian;
|
||||
Button kodiaus;
|
||||
ImageView togglepassword;
|
||||
|
||||
|
||||
private HomeViewModel homeViewModel;
|
||||
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@ -69,8 +63,6 @@ public class HomeFragment extends Fragment {
|
||||
password = prefs.getString("password", null);
|
||||
ip = prefs.getString("ip", null);
|
||||
|
||||
homeViewModel =
|
||||
new ViewModelProvider(this).get(HomeViewModel.class);
|
||||
View root = inflater.inflate(R.layout.fragment_home, container, false);
|
||||
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||
String Background = p.getString("Background", null);
|
||||
|
@ -1,7 +0,0 @@
|
||||
package de.jg_cody.Teraplex.ui.home;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class HomeViewModel extends ViewModel {
|
||||
|
||||
}
|
@ -10,7 +10,6 @@ import android.widget.VideoView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import de.jg_cody.Teraplex.R;
|
||||
|
||||
@ -22,12 +21,10 @@ public class IntroFragment extends Fragment {
|
||||
MediaPlayer mMediaPlayer;
|
||||
int mCurrentVideoPosition;
|
||||
|
||||
private IntroViewModel introViewModel;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
introViewModel =
|
||||
new ViewModelProvider(this).get(IntroViewModel.class);
|
||||
|
||||
View root = inflater.inflate(R.layout.fragment_intro, container, false);
|
||||
|
||||
// Hook up the VideoView to our UI.
|
||||
|
@ -1,19 +0,0 @@
|
||||
package de.jg_cody.Teraplex.ui.intro;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class IntroViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<String> mText;
|
||||
|
||||
public IntroViewModel() {
|
||||
mText = new MutableLiveData<>();
|
||||
mText.setValue("INTRO");
|
||||
}
|
||||
|
||||
public LiveData<String> getText() {
|
||||
return mText;
|
||||
}
|
||||
}
|
@ -22,7 +22,6 @@ import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
@ -35,12 +34,11 @@ import static android.content.Context.MODE_PRIVATE;
|
||||
public class SettingsFragment extends Fragment {
|
||||
|
||||
private EditText editExportFile_name;
|
||||
private SettingsViewModel settingsViewModel;
|
||||
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
settingsViewModel =
|
||||
new ViewModelProvider(this).get(SettingsViewModel.class);
|
||||
|
||||
View root = inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||
String Background = p.getString("Background", null);
|
||||
|
@ -1,8 +0,0 @@
|
||||
package de.jg_cody.Teraplex.ui.settings;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class SettingsViewModel extends ViewModel {
|
||||
|
||||
|
||||
}
|
@ -4,5 +4,6 @@ import android.view.View;
|
||||
|
||||
public interface IViewHolder {
|
||||
abstract public String getCommand();
|
||||
|
||||
abstract public View[] getViews();
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ListItemViewHo
|
||||
|
||||
private AddButtonsDialogDouble.AddButtonsDialogListenerDouble listener;
|
||||
private EditText editText_name, editText_command, editText_command1, editText_button1, editText_command2, editText_button2, editText_button_name;
|
||||
private TabsFragment frag;
|
||||
|
||||
ListAdapter listAdapter;
|
||||
|
||||
|
@ -7,15 +7,6 @@ public class ListItemHeadline extends ListItem{
|
||||
super( ListAdapter.HEADLINE);
|
||||
this.name = name;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -12,30 +12,6 @@ public class ListItemSingle extends ListItem{
|
||||
this.command = command;
|
||||
|
||||
}
|
||||
public void setButtonName(String buttonName)
|
||||
{
|
||||
this.buttonName = buttonName;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
public String getButtonName()
|
||||
{
|
||||
return buttonName;
|
||||
}
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setCommand(String command)
|
||||
{
|
||||
this.command = command;
|
||||
}
|
||||
public String getCommand()
|
||||
{
|
||||
return command;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStrings() {
|
||||
|
@ -16,7 +16,6 @@ import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -41,7 +40,6 @@ import static android.content.Context.MODE_PRIVATE;
|
||||
|
||||
public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddButtonDialogListenerSingle, AddButtonsDialogDouble.AddButtonsDialogListenerDouble, AddHeadlineDialog.AddHeadlineDialogListener {
|
||||
|
||||
private TabsViewModel tabsViewModel;
|
||||
|
||||
String[] commands = {"Hello1", "Hello2", "Hello3", "Hello4", "Hello5"};
|
||||
int[] type = {0, 1, 0, 0, 1};
|
||||
@ -53,7 +51,6 @@ public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddB
|
||||
ArrayList<ListItem> items;
|
||||
|
||||
|
||||
|
||||
String tabname;
|
||||
|
||||
|
||||
@ -64,8 +61,7 @@ public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddB
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
tabsViewModel =
|
||||
new ViewModelProvider(this).get(TabsViewModel.class);
|
||||
|
||||
View root = inflater.inflate(R.layout.fragment_tabs, container, false);
|
||||
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||
String Background = p.getString("Background", null);
|
||||
@ -249,7 +245,7 @@ public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddB
|
||||
JSONObject item = listItems2.getJSONObject(i);
|
||||
listAdapter.add(ListItem.fromJson(item));
|
||||
}
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
public static void save(String tabname, Context context, ListAdapter listAdapter) throws JSONException {
|
||||
@ -261,6 +257,7 @@ public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddB
|
||||
editor.putString("listItems." + tabname, listItems2.toString());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void save() throws JSONException {
|
||||
save(tabname, requireContext(), listAdapter);
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
package de.jg_cody.Teraplex.ui.tabs;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class TabsViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<String> mText;
|
||||
|
||||
public TabsViewModel() {
|
||||
mText = new MutableLiveData<>();
|
||||
mText.setValue("TABS");
|
||||
}
|
||||
|
||||
public LiveData<String> getText() {
|
||||
return mText;
|
||||
}
|
||||
}
|
@ -2,34 +2,11 @@ package de.jg_cody.Teraplex.ui.tabs;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class ViewHolderDoubleButton implements IViewHolder{
|
||||
String commandL;
|
||||
String commandR;
|
||||
Button bLeft, bRight;
|
||||
|
||||
public ViewHolderDoubleButton(Button bLeft, Button bRight, String commandL, String commandR) {
|
||||
this.bLeft = bLeft;
|
||||
this.bRight = bRight;
|
||||
this.commandL = commandL;
|
||||
this.commandR = commandR;
|
||||
|
||||
bLeft.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(bLeft.getContext(),commandL + " ON",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
bRight.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(bRight.getContext(),commandR + " OFF",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getCommand() {
|
||||
return commandL;
|
||||
|
@ -2,27 +2,13 @@ package de.jg_cody.Teraplex.ui.tabs;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class ViewHolderSingleButton implements IViewHolder {
|
||||
|
||||
String command;
|
||||
Button bRun;
|
||||
|
||||
public ViewHolderSingleButton(Button bRun, String command) {
|
||||
this.bRun = bRun;
|
||||
this.command = command;
|
||||
|
||||
bRun.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(bRun.getContext(),command + " ON",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
@Override
|
||||
public String getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@ -34,12 +33,11 @@ public class TerminalFragment extends Fragment {
|
||||
ScrollView scrollView;
|
||||
public static String user, password, ip;
|
||||
|
||||
private TerminalViewModel terminalViewModel;
|
||||
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
terminalViewModel =
|
||||
new ViewModelProvider(this).get(TerminalViewModel.class);
|
||||
|
||||
View root = inflater.inflate(R.layout.fragment_terminal, container, false);
|
||||
SharedPreferences prefs = requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE);
|
||||
user = prefs.getString("user", null);
|
||||
|
@ -1,8 +0,0 @@
|
||||
package de.jg_cody.Teraplex.ui.terminal;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class TerminalViewModel extends ViewModel {
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation = "vertical"
|
||||
|
@ -2,7 +2,6 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:gravity="bottom"
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
android:layout_margin="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:padding="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_cricketer_name"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Cricketer Name"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black"></TextView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_team_name"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Team Name"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"></TextView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<com.rarepebble.colorpicker.ColorPreference
|
||||
android:key="simplePreference"
|
||||
android:title="@string/pref_title"
|
||||
android:defaultValue="#f00"
|
||||
/>
|
||||
|
||||
<com.rarepebble.colorpicker.ColorPreference
|
||||
android:key="optionalColor"
|
||||
android:title="@string/pref_optional_color"
|
||||
app:colorpicker_noneSelectedSummaryText="@string/no_color_selected"
|
||||
android:summary="@string/pref_optional_color_summary"
|
||||
app:colorpicker_selectNoneButtonText="@string/no_color"
|
||||
/>
|
||||
|
||||
<com.rarepebble.colorpicker.ColorPreference
|
||||
android:key="optionalColorWithDefault"
|
||||
android:title="@string/pref_default_color"
|
||||
android:summary="@string/pref_default_color_summary"
|
||||
android:defaultValue="#f0f"
|
||||
app:colorpicker_selectNoneButtonText="@string/default_color"
|
||||
/>
|
||||
|
||||
<com.rarepebble.colorpicker.ColorPreference
|
||||
android:key="opaquePreference"
|
||||
android:title="@string/pref_no_alpha"
|
||||
android:summary="@string/pref_no_alpha_summary"
|
||||
app:colorpicker_showAlpha="false"
|
||||
android:defaultValue="#00f"
|
||||
/>
|
||||
|
||||
|
||||
<com.rarepebble.colorpicker.ColorPreference
|
||||
android:key="opaquePreferenceNoHex"
|
||||
android:title="@string/pref_title_minimal"
|
||||
android:summary="@string/pref_title_minimal_summary"
|
||||
app:colorpicker_showAlpha="false"
|
||||
app:colorpicker_showHex="false"
|
||||
android:defaultValue="@color/example_color_resource"
|
||||
/>
|
||||
|
||||
<PreferenceScreen
|
||||
android:title="@string/pref_show_view_usage_demo">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetClass="com.rarepebble.colorpickerdemo.ViewDemoActivity"
|
||||
android:targetPackage="com.rarepebble.colorpickerdemo" />
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user