.
This commit is contained in:
parent
4245d7fbb0
commit
327e3e8615
@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="deploymentTargetDropDown">
|
<component name="deploymentTargetDropDown">
|
||||||
|
<value>
|
||||||
|
<entry key="app">
|
||||||
|
<State>
|
||||||
<targetSelectedWithDropDown>
|
<targetSelectedWithDropDown>
|
||||||
<Target>
|
<Target>
|
||||||
<type value="QUICK_BOOT_TARGET" />
|
<type value="QUICK_BOOT_TARGET" />
|
||||||
@ -12,6 +15,9 @@
|
|||||||
</deviceKey>
|
</deviceKey>
|
||||||
</Target>
|
</Target>
|
||||||
</targetSelectedWithDropDown>
|
</targetSelectedWithDropDown>
|
||||||
<timeTargetWasSelectedWithDropDown value="2024-02-25T16:19:56.097941500Z" />
|
<timeTargetWasSelectedWithDropDown value="2024-02-27T15:55:21.747795900Z" />
|
||||||
|
</State>
|
||||||
|
</entry>
|
||||||
|
</value>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -4,16 +4,15 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="GRADLE" />
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="jbr-17" />
|
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
|
<option name="resolveExternalAnnotations" value="false" />
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
@ -17,6 +17,10 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Switch;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.example.onetap_ssh.fragment.AboutFragment;
|
import com.example.onetap_ssh.fragment.AboutFragment;
|
||||||
import com.example.onetap_ssh.fragment.SettingsFragment;
|
import com.example.onetap_ssh.fragment.SettingsFragment;
|
||||||
@ -28,6 +32,7 @@ import com.example.onetap_ssh.util.ThemeUtil;
|
|||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.core.view.GravityCompat;
|
import androidx.core.view.GravityCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@ -67,19 +72,12 @@ public class MainActivity extends BaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
ThemeUtil.loadBackground(this);
|
||||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
setSupportActionBar(binding.appBarMain.toolbar);
|
setSupportActionBar(binding.appBarMain.toolbar);
|
||||||
binding.appBarMain.fab.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
DrawerLayout drawer = findViewById(R.id.app_background);
|
||||||
public void onClick(View view) {
|
|
||||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
|
||||||
.setAction("Action", null).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
|
||||||
NavigationView navigationView = binding.navView;
|
NavigationView navigationView = binding.navView;
|
||||||
// Passing each menu ID as a set of Ids because each
|
// Passing each menu ID as a set of Ids because each
|
||||||
// menu should be considered as top level destinations.
|
// menu should be considered as top level destinations.
|
||||||
@ -92,7 +90,168 @@ public class MainActivity extends BaseActivity {
|
|||||||
NavigationUI.setupWithNavController(navigationView, navController);
|
NavigationUI.setupWithNavController(navigationView, navController);
|
||||||
SharedPreferences p = getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
SharedPreferences p = getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||||
button_vibration = p.getBoolean("Vibration", false );
|
button_vibration = p.getBoolean("Vibration", false );
|
||||||
|
((Switch) navigationView.getMenu().getItem(2).getActionView().findViewById(R.id.switch_editmode)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
|
||||||
|
if (button_vibration) {
|
||||||
|
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
assert vr != null;
|
||||||
|
vr.vibrate(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
editmode = isChecked;
|
||||||
|
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
|
||||||
|
NavHostFragment nhf = (NavHostFragment) currentFragment;
|
||||||
|
assert nhf != null;
|
||||||
|
Fragment childfragment = nhf.getChildFragmentManager().getFragments().get(0);
|
||||||
|
if (childfragment instanceof TabsFragment) {
|
||||||
|
try {
|
||||||
|
((TabsFragment) childfragment).load();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
navigationView.getMenu().getItem(3).setVisible(editmode);
|
||||||
|
navigationView.getMenu().getItem(4).setVisible(editmode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
navigationView.getMenu().getItem(3).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
if (button_vibration) {
|
||||||
|
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
assert vr != null;
|
||||||
|
vr.vibrate(100);
|
||||||
|
}
|
||||||
|
AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
|
||||||
|
|
||||||
|
|
||||||
|
LayoutInflater inflater = getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.addtabdialog, null);
|
||||||
|
EditText editText_name = view.findViewById(R.id.dialogtab_editText_name);
|
||||||
|
|
||||||
|
|
||||||
|
mBuilder.setView(view)
|
||||||
|
.setTitle(R.string.menu_add);
|
||||||
|
mBuilder.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (button_vibration) {
|
||||||
|
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
assert vr != null;
|
||||||
|
vr.vibrate(100);
|
||||||
|
}
|
||||||
|
String tabname = editText_name.getText().toString().trim();
|
||||||
|
|
||||||
|
SharedPreferences p = getSharedPreferences("appsettings", MODE_PRIVATE);
|
||||||
|
String tabsString = p.getString("tabs", null);
|
||||||
|
List<String> tabs = new ArrayList<String>();
|
||||||
|
if (tabsString != null) {
|
||||||
|
try {
|
||||||
|
JSONArray tabsArray = new JSONArray(tabsString);
|
||||||
|
for (int i = 0; i < tabsArray.length(); i++) {
|
||||||
|
tabs.add(tabsArray.getString(i));
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tabs.contains(tabname)) {
|
||||||
|
|
||||||
|
AlertDialog mDialog = new AlertDialog.Builder(MainActivity.this)
|
||||||
|
.setTitle(getString(R.string.tabname))
|
||||||
|
.setMessage(getString(R.string.tabname_already_exist))
|
||||||
|
|
||||||
|
// Specifying a listener allows you to take an action before dismissing the dialog.
|
||||||
|
// The dialog is automatically dismissed when a dialog button is clicked.
|
||||||
|
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
if (button_vibration) {
|
||||||
|
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
assert vr != null;
|
||||||
|
vr.vibrate(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).create();
|
||||||
|
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
|
||||||
|
mDialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; //style id
|
||||||
|
mDialog.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tabname.isEmpty()) {
|
||||||
|
|
||||||
|
AlertDialog mDialog = new AlertDialog.Builder(MainActivity.this)
|
||||||
|
.setTitle(getString(R.string.tabname))
|
||||||
|
.setMessage(getString(R.string.invalid))
|
||||||
|
|
||||||
|
// Specifying a listener allows you to take an action before dismissing the dialog.
|
||||||
|
// The dialog is automatically dismissed when a dialog button is clicked.
|
||||||
|
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
if (button_vibration) {
|
||||||
|
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
assert vr != null;
|
||||||
|
vr.vibrate(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).create();
|
||||||
|
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
|
||||||
|
mDialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; //style id
|
||||||
|
mDialog.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MenuItem item = navigationView.getMenu().add(R.id.dynamicgroup, lastID++, 3, tabname);
|
||||||
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
if (button_vibration) {
|
||||||
|
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
assert vr != null;
|
||||||
|
vr.vibrate(100);
|
||||||
|
}
|
||||||
|
DrawerLayout mDrawerLayout;
|
||||||
|
mDrawerLayout = (DrawerLayout) findViewById(R.id.app_background);
|
||||||
|
mDrawerLayout.closeDrawer(GravityCompat.START);
|
||||||
|
Objects.requireNonNull(getSupportActionBar()).setTitle(tabname);
|
||||||
|
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
|
||||||
|
NavHostFragment nhf = (NavHostFragment) currentFragment;
|
||||||
|
assert nhf != null;
|
||||||
|
nhf.getChildFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new TabsFragment(tabname)).commit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tabitems.put(tabname, item);
|
||||||
|
|
||||||
|
|
||||||
|
tabs.add(tabname);
|
||||||
|
SharedPreferences.Editor editor = p.edit();
|
||||||
|
editor.putString("tabs", new JSONArray(tabs).toString());
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
if (button_vibration) {
|
||||||
|
Vibrator vr = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
assert vr != null;
|
||||||
|
vr.vibrate(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog mDialog = mBuilder.create();
|
||||||
|
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
|
||||||
|
mDialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; //style id
|
||||||
|
mDialog.show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
//launchApp();
|
//launchApp();
|
||||||
|
|
||||||
navigationView.getMenu().getItem(4).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
navigationView.getMenu().getItem(4).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@ -193,7 +352,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
vr.vibrate(100);
|
vr.vibrate(100);
|
||||||
}
|
}
|
||||||
DrawerLayout mDrawerLayout;
|
DrawerLayout mDrawerLayout;
|
||||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
mDrawerLayout = (DrawerLayout) findViewById(R.id.app_background);
|
||||||
mDrawerLayout.closeDrawer(GravityCompat.START);
|
mDrawerLayout.closeDrawer(GravityCompat.START);
|
||||||
Objects.requireNonNull(getSupportActionBar()).setTitle(tab);
|
Objects.requireNonNull(getSupportActionBar()).setTitle(tab);
|
||||||
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
|
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
|
||||||
@ -221,6 +380,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|
||||||
|| super.onSupportNavigateUp();
|
|| super.onSupportNavigateUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
// Handle action bar item clicks here. The action bar will
|
// Handle action bar item clicks here. The action bar will
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
@ -350,4 +510,9 @@ public class MainActivity extends BaseActivity {
|
|||||||
super.recreate();
|
super.recreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
package com.example.onetap_ssh;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.animation.OvershootInterpolator;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
|
public class MovableFloatingActionButton extends FloatingActionButton implements View.OnTouchListener {
|
||||||
|
CustomClickListener customClickListener;
|
||||||
|
|
||||||
|
private final static float CLICK_DRAG_TOLERANCE = 10; // Often, there will be a slight, unintentional, drag when the user taps the FAB, so we need to account for this.
|
||||||
|
|
||||||
|
private float downRawX, downRawY;
|
||||||
|
private float dX, dY;
|
||||||
|
|
||||||
|
int viewWidth;
|
||||||
|
int viewHeight;
|
||||||
|
|
||||||
|
int parentWidth;
|
||||||
|
int parentHeight;
|
||||||
|
|
||||||
|
float newX;
|
||||||
|
float newY;
|
||||||
|
|
||||||
|
public MovableFloatingActionButton(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovableFloatingActionButton(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovableFloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
setOnTouchListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
|
||||||
|
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
||||||
|
|
||||||
|
int action = motionEvent.getAction();
|
||||||
|
if (action == MotionEvent.ACTION_DOWN) {
|
||||||
|
|
||||||
|
downRawX = motionEvent.getRawX();
|
||||||
|
downRawY = motionEvent.getRawY();
|
||||||
|
dX = view.getX() - downRawX;
|
||||||
|
dY = view.getY() - downRawY;
|
||||||
|
|
||||||
|
return false; // not Consumed for ripple effect
|
||||||
|
|
||||||
|
} else if (action == MotionEvent.ACTION_MOVE) {
|
||||||
|
|
||||||
|
viewWidth = view.getWidth();
|
||||||
|
viewHeight = view.getHeight();
|
||||||
|
|
||||||
|
View viewParent = (View) view.getParent();
|
||||||
|
parentWidth = viewParent.getWidth();
|
||||||
|
parentHeight = viewParent.getHeight();
|
||||||
|
|
||||||
|
newX = motionEvent.getRawX() + dX;
|
||||||
|
newX = Math.max(layoutParams.leftMargin, newX); // Don't allow the FAB past the left hand side of the parent
|
||||||
|
newX = Math.min(parentWidth - viewWidth - layoutParams.rightMargin, newX); // Don't allow the FAB past the right hand side of the parent
|
||||||
|
|
||||||
|
newY = motionEvent.getRawY() + dY;
|
||||||
|
newY = Math.max(layoutParams.topMargin, newY); // Don't allow the FAB past the top of the parent
|
||||||
|
newY = Math.min(parentHeight - viewHeight - layoutParams.bottomMargin, newY); // Don't allow the FAB past the bottom of the parent
|
||||||
|
|
||||||
|
view.animate()
|
||||||
|
.x(newX)
|
||||||
|
.y(newY)
|
||||||
|
.setDuration(0)
|
||||||
|
.start();
|
||||||
|
|
||||||
|
return true; // Consumed
|
||||||
|
|
||||||
|
} else if (action == MotionEvent.ACTION_UP) {
|
||||||
|
|
||||||
|
float upRawX = motionEvent.getRawX();
|
||||||
|
float upRawY = motionEvent.getRawY();
|
||||||
|
|
||||||
|
float upDX = upRawX - downRawX;
|
||||||
|
float upDY = upRawY - downRawY;
|
||||||
|
|
||||||
|
if (newX > ((parentWidth - viewWidth - layoutParams.rightMargin) / 2)) {
|
||||||
|
newX = parentWidth - viewWidth - layoutParams.rightMargin;
|
||||||
|
} else {
|
||||||
|
newX = layoutParams.leftMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
view.animate()
|
||||||
|
.x(newX)
|
||||||
|
.y(newY)
|
||||||
|
.setInterpolator(new OvershootInterpolator())
|
||||||
|
.setDuration(600)
|
||||||
|
.start();
|
||||||
|
|
||||||
|
if (Math.abs(upDX) < CLICK_DRAG_TOLERANCE && Math.abs(upDY) < CLICK_DRAG_TOLERANCE) { // A click
|
||||||
|
if (customClickListener != null) {
|
||||||
|
customClickListener.onClick(view);
|
||||||
|
}
|
||||||
|
return false;// not Consumed for ripple effect
|
||||||
|
} else { // A drag
|
||||||
|
return false; // not Consumed for ripple effect
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return super.onTouchEvent(motionEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface CustomClickListener {
|
||||||
|
void onClick(View view);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -66,12 +66,7 @@ public class HomeFragment extends Fragment {
|
|||||||
View root = inflater.inflate(R.layout.fragment_home, container, false);
|
View root = inflater.inflate(R.layout.fragment_home, container, false);
|
||||||
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||||
String Background = p.getString("Background", null);
|
String Background = p.getString("Background", null);
|
||||||
if (Background != null) {
|
|
||||||
ImageView I = root.findViewById(R.id.Background);
|
|
||||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
|
||||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
|
||||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
|
||||||
}
|
|
||||||
final TextView textView = root.findViewById(R.id.text_home);
|
final TextView textView = root.findViewById(R.id.text_home);
|
||||||
final TextView login_data = root.findViewById(R.id.login_data);
|
final TextView login_data = root.findViewById(R.id.login_data);
|
||||||
if (user == null || ip == null) {
|
if (user == null || ip == null) {
|
||||||
|
@ -66,12 +66,7 @@ public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddB
|
|||||||
View root = inflater.inflate(R.layout.fragment_tabs, container, false);
|
View root = inflater.inflate(R.layout.fragment_tabs, container, false);
|
||||||
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||||
String Background = p.getString("Background", null);
|
String Background = p.getString("Background", null);
|
||||||
if (Background != null) {
|
|
||||||
ImageView I = root.findViewById(R.id.Background);
|
|
||||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
|
||||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
|
||||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
listView = root.findViewById(R.id.listView);
|
listView = root.findViewById(R.id.listView);
|
||||||
|
BIN
app/src/main/res/drawable/onetap_ssh.png
Normal file
BIN
app/src/main/res/drawable/onetap_ssh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
39
app/src/main/res/drawable/sidemenu.xml
Normal file
39
app/src/main/res/drawable/sidemenu.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<stroke
|
||||||
|
android:width="0dp"
|
||||||
|
android:color="#FFFFFF" />
|
||||||
|
<gradient
|
||||||
|
android:angle="90"
|
||||||
|
android:endColor="?attr/colorPrimary"
|
||||||
|
android:startColor="?attr/colorSecondary" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="0dp"
|
||||||
|
android:bottomRightRadius="0dp"
|
||||||
|
android:topLeftRadius="0dp"
|
||||||
|
android:topRightRadius="0dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:bottom="0dp"
|
||||||
|
android:left="0dp"
|
||||||
|
android:right="2dp"
|
||||||
|
android:top="0dp">
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<stroke
|
||||||
|
android:width="0dp"
|
||||||
|
android:color="#FFFFFF" />
|
||||||
|
<gradient
|
||||||
|
android:angle="180"
|
||||||
|
android:endColor="?attr/colorOnBackground"
|
||||||
|
android:startColor="?attr/colorOnBackground" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="0dp"
|
||||||
|
android:bottomRightRadius="0dp"
|
||||||
|
android:topLeftRadius="0dp"
|
||||||
|
android:topRightRadius="0dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
@ -5,7 +5,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:id="@+id/drawer_layout"
|
|
||||||
|
android:id="@+id/app_background"
|
||||||
tools:openDrawer="start">
|
tools:openDrawer="start">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
@ -21,5 +22,6 @@
|
|||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
app:headerLayout="@layout/nav_header_main"
|
app:headerLayout="@layout/nav_header_main"
|
||||||
app:menu="@menu/activity_main_drawer" />
|
app:menu="@menu/activity_main_drawer"
|
||||||
|
android:background="@drawable/sidemenu"/>
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
</androidx.drawerlayout.widget.DrawerLayout>
|
@ -20,13 +20,6 @@
|
|||||||
|
|
||||||
<include layout="@layout/content_main" />
|
<include layout="@layout/content_main" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/fab"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|end"
|
|
||||||
android:layout_marginEnd="@dimen/fab_margin"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
app:srcCompat="@android:drawable/ic_dialog_email" />
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -8,7 +8,7 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/doubleButton_bLeft"
|
android:id="@+id/doubleButton_bLeft"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
@ -18,7 +18,7 @@
|
|||||||
android:text="Button1"
|
android:text="Button1"
|
||||||
app:backgroundTint="@null" />
|
app:backgroundTint="@null" />
|
||||||
|
|
||||||
<Button
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/doubleButton_text"
|
android:id="@+id/doubleButton_text"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
@ -28,7 +28,7 @@
|
|||||||
android:text="Button1"
|
android:text="Button1"
|
||||||
app:backgroundTint="@null" />
|
app:backgroundTint="@null" />
|
||||||
|
|
||||||
<Button
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/doubleButton_bRight"
|
android:id="@+id/doubleButton_bRight"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
@ -46,7 +46,7 @@
|
|||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
app:srcCompat="@drawable/mode_edit_black_24dp"
|
app:srcCompat="@drawable/mode_edit_black_24dp"
|
||||||
app:tint="?attr/colorOnPrimary"
|
app:tint="?android:attr/textColor"
|
||||||
tools:ignore="VectorDrawableCompat">
|
tools:ignore="VectorDrawableCompat">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
@ -58,7 +58,7 @@
|
|||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
app:srcCompat="@drawable/clear_black_24dp"
|
app:srcCompat="@drawable/clear_black_24dp"
|
||||||
app:tint="?attr/colorOnPrimary"
|
app:tint="?android:attr/textColor"
|
||||||
tools:ignore="VectorDrawableCompat">
|
tools:ignore="VectorDrawableCompat">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
@ -5,12 +5,19 @@
|
|||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/dialogexport_editText_name"
|
android:id="@+id/dialogexport_editText_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="@string/filename"
|
android:hint="@string/filename"
|
||||||
android:inputType="textPersonName" />
|
android:inputType="textPassword"/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:hapticFeedbackEnabled="true"
|
android:hapticFeedbackEnabled="true"
|
||||||
android:padding="25dp"
|
android:padding="25dp"
|
||||||
android:background="@drawable/background_red_blue"
|
|
||||||
tools:context=".ui.home.HomeFragment">
|
tools:context=".ui.home.HomeFragment">
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,13 +7,16 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<ImageView
|
<com.example.onetap_ssh.MovableFloatingActionButton
|
||||||
android:id="@+id/Background"
|
android:id="@+id/fab"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:background="#80FFFFFF"
|
android:layout_gravity="bottom|end"
|
||||||
android:scaleType="centerCrop"
|
android:layout_marginHorizontal="16dp"
|
||||||
android:src="@drawable/background_red_blue" />
|
android:layout_marginVertical="16dp"
|
||||||
|
android:hapticFeedbackEnabled="true"
|
||||||
|
android:src="@drawable/add_black_24dp"
|
||||||
|
app:backgroundTint="?attr/colorTheme1" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/listView"
|
android:id="@+id/listView"
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
app:srcCompat="@drawable/mode_edit_black_24dp"
|
app:srcCompat="@drawable/mode_edit_black_24dp"
|
||||||
app:tint="?attr/colorOnPrimary"
|
app:tint="?android:attr/textColor"
|
||||||
tools:ignore="VectorDrawableCompat">
|
tools:ignore="VectorDrawableCompat">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
@ -41,7 +41,7 @@
|
|||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
app:srcCompat="@drawable/clear_black_24dp"
|
app:srcCompat="@drawable/clear_black_24dp"
|
||||||
app:tint="?attr/colorOnPrimary"
|
app:tint="?android:attr/textColor"
|
||||||
tools:ignore="VectorDrawableCompat">
|
tools:ignore="VectorDrawableCompat">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
@ -15,25 +15,23 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="80dp"
|
android:layout_height="120dp"
|
||||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||||
android:src="@drawable/teraplex_logo"
|
android:src="@drawable/onetap_ssh"
|
||||||
app:tint="@color/mtrl_btn_text_color_selector"
|
app:tint="?android:attr/textColor"
|
||||||
android:contentDescription="TODO" />
|
android:contentDescription="TODO" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||||
android:text="@string/ssh_remote"
|
android:text="@string/app_name"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||||
android:textColor="@color/mtrl_btn_text_color_selector" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="WWW.JG-CODY.DE"
|
android:text="onetap-ssh.com"/>
|
||||||
android:textColor="@color/mtrl_btn_text_color_selector" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -7,7 +7,7 @@
|
|||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/singleButton_text"
|
android:id="@+id/singleButton_text"
|
||||||
android:layout_width="10dp"
|
android:layout_width="10dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
@ -18,7 +18,7 @@
|
|||||||
android:text="TEXT"
|
android:text="TEXT"
|
||||||
app:backgroundTint="@null" />
|
app:backgroundTint="@null" />
|
||||||
|
|
||||||
<Button
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/singleButton_button"
|
android:id="@+id/singleButton_button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
@ -37,7 +37,7 @@
|
|||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
app:srcCompat="@drawable/mode_edit_black_24dp"
|
app:srcCompat="@drawable/mode_edit_black_24dp"
|
||||||
app:tint="?attr/colorOnPrimary"
|
app:tint="?android:attr/textColor"
|
||||||
tools:ignore="VectorDrawableCompat">
|
tools:ignore="VectorDrawableCompat">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
app:srcCompat="@drawable/clear_black_24dp"
|
app:srcCompat="@drawable/clear_black_24dp"
|
||||||
app:tint="?attr/colorOnPrimary"
|
app:tint="?android:attr/textColor"
|
||||||
tools:ignore="VectorDrawableCompat">
|
tools:ignore="VectorDrawableCompat">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
@ -11,20 +11,6 @@
|
|||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/image_edit"
|
|
||||||
android:layout_width="00dp"
|
|
||||||
android:layout_height="00dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:srcCompat="@drawable/mode_edit_black_24dp"
|
|
||||||
app:tint="?attr/colorOnPrimary"
|
|
||||||
tools:ignore="VectorDrawableCompat">
|
|
||||||
|
|
||||||
</ImageView>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image_remove"
|
android:id="@+id/image_remove"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
@ -33,7 +19,7 @@
|
|||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
app:srcCompat="@drawable/clear_black_24dp"
|
app:srcCompat="@drawable/clear_black_24dp"
|
||||||
app:tint="?attr/colorOnPrimary"
|
app:tint="?android:attr/textColor"
|
||||||
tools:ignore="VectorDrawableCompat">
|
tools:ignore="VectorDrawableCompat">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/Frage"
|
android:id="@+id/Frage"
|
||||||
android:icon="@drawable/contact_support_black_24dp"
|
android:icon="@drawable/contact_support_black_24dp"
|
||||||
|
android:iconTint="?android:attr/textColor"
|
||||||
android:onClick="menurighttopdocumentation"
|
android:onClick="menurighttopdocumentation"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:title="@string/menu_documentation"
|
android:title="@string/menu_documentation"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '8.1.2' apply false
|
id 'com.android.application' version '8.2.2' apply false
|
||||||
id 'com.android.library' version '8.1.2' apply false
|
id 'com.android.library' version '8.2.2' apply false
|
||||||
id 'com.google.protobuf' version '0.9.3' apply false
|
id 'com.google.protobuf' version '0.9.3' apply false
|
||||||
}
|
}
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Fri Feb 23 15:25:44 CET 2024
|
#Fri Feb 23 15:25:44 CET 2024
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
Loading…
Reference in New Issue
Block a user