UI revamp bySerpent
UI revamp (v2)
@ -68,11 +68,14 @@ dependencies {
|
||||
// implementation 'com.wu-man:android-bsf-api:3.1.3'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'androidx.annotation:annotation:1.0.0'
|
||||
implementation 'androidx.browser:browser:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.annotation:annotation:1.1.0'
|
||||
implementation 'androidx.browser:browser:1.3.0'
|
||||
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
|
||||
|
||||
|
||||
// implementation 'com.intuit.sdp:sdp-android:1.0.5'
|
||||
// implementation 'com.intuit.ssp:ssp-android:1.0.5'
|
||||
|
@ -75,10 +75,7 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
||||
case 2: // Custom controls
|
||||
startActivity(new Intent(BaseLauncherActivity.this, CustomControlsActivity.class));
|
||||
break;
|
||||
case 3: // Settings
|
||||
startActivity(new Intent(BaseLauncherActivity.this, LauncherPreferenceActivity.class));
|
||||
break;
|
||||
case 4: { // About
|
||||
case 3: { // About
|
||||
final AlertDialog.Builder aboutB = new AlertDialog.Builder(BaseLauncherActivity.this);
|
||||
aboutB.setTitle(R.string.mcl_option_about);
|
||||
try {
|
||||
@ -223,7 +220,8 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
||||
File lastCrashFile = Tools.lastFileModified(Tools.DIR_HOME_CRASH);
|
||||
if(CrashFragment.isNewCrash(lastCrashFile) || !mCrashView.getLastCrash().isEmpty()){
|
||||
mCrashView.resetCrashLog = false;
|
||||
selectTabPage(2);
|
||||
initTabs(2);
|
||||
|
||||
} /*else throw new Exception();*/
|
||||
} catch(Throwable e) {
|
||||
e.printStackTrace();
|
||||
@ -238,6 +236,5 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
protected abstract void selectTabPage(int pageIndex);
|
||||
protected abstract float updateWidthHeight();
|
||||
protected abstract void initTabs(int pageIndex);
|
||||
}
|
||||
|
@ -1,170 +0,0 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import android.os.*;
|
||||
|
||||
import androidx.core.app.*;
|
||||
import androidx.core.view.*;
|
||||
import androidx.appcompat.app.*;
|
||||
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.kdt.pojavlaunch.fragments.*;
|
||||
|
||||
import org.lwjgl.glfw.*;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import android.support.design.widget.VerticalTabLayout.*;
|
||||
|
||||
//import android.support.v7.view.menu.*;
|
||||
//import net.zhuoweizhang.boardwalk.downloader.*;
|
||||
|
||||
public class MCLauncherActivity extends BaseLauncherActivity
|
||||
{
|
||||
//private FragmentTabHost mTabHost;
|
||||
private LinearLayout fullTab;
|
||||
/*
|
||||
private PojavLauncherViewPager viewPager;
|
||||
private VerticalTabLayout tabLayout;
|
||||
*/
|
||||
|
||||
private ViewPager viewPager;
|
||||
private TabLayout tabLayout;
|
||||
|
||||
private TextView tvUsernameView;
|
||||
private ViewPagerAdapter viewPageAdapter;
|
||||
|
||||
private Button switchUsrBtn, logoutBtn; // MineButtons
|
||||
private ViewGroup leftView, rightView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
Toast.makeText(this, "Launcher process id: " + android.os.Process.myPid(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
setContentView(R.layout.launcher_main);
|
||||
|
||||
fullTab = findViewById(R.id.launchermainFragmentTabView);
|
||||
tabLayout = findViewById(R.id.launchermainTabLayout);
|
||||
viewPager = findViewById(R.id.launchermainTabPager);
|
||||
|
||||
mConsoleView = new ConsoleFragment();
|
||||
mCrashView = new CrashFragment();
|
||||
|
||||
viewPageAdapter = new ViewPagerAdapter(getSupportFragmentManager());
|
||||
|
||||
viewPageAdapter.addFragment(new LauncherFragment(), 0, getStr(R.string.mcl_tab_news));
|
||||
viewPageAdapter.addFragment(mConsoleView, 0, getStr(R.string.mcl_tab_console));
|
||||
viewPageAdapter.addFragment(mCrashView, 0, getStr(R.string.mcl_tab_crash));
|
||||
|
||||
viewPager.setAdapter(viewPageAdapter);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
tvUsernameView = (TextView) findViewById(R.id.launchermain_text_welcome);
|
||||
mTextVersion = (TextView) findViewById(R.id.launcherMainVersionView);
|
||||
|
||||
try {
|
||||
mProfile = PojavProfile.getCurrentProfileContent(this);
|
||||
|
||||
tvUsernameView.setText(getString(R.string.main_welcome, mProfile.username));
|
||||
} catch(Exception e) {
|
||||
Tools.showError(this, e);
|
||||
}
|
||||
|
||||
//showProfileInfo();
|
||||
|
||||
List<String> versions = new ArrayList<String>();
|
||||
final File fVers = new File(Tools.DIR_HOME_VERSION);
|
||||
|
||||
try {
|
||||
if (fVers.listFiles().length < 1) {
|
||||
throw new Exception(getStr(R.string.error_no_version));
|
||||
}
|
||||
|
||||
for (File fVer : fVers.listFiles()) {
|
||||
if (fVer.isDirectory())
|
||||
versions.add(fVer.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
versions.add(getStr(R.string.global_error) + ":");
|
||||
versions.add(e.getMessage());
|
||||
|
||||
} finally {
|
||||
mAvailableVersions = versions.toArray(new String[0]);
|
||||
}
|
||||
|
||||
//availableVersions;
|
||||
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAvailableVersions);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
|
||||
mVersionSelector = (Spinner) findViewById(R.id.launcherMainSelectVersion);
|
||||
mVersionSelector.setAdapter(adapter);
|
||||
|
||||
mLaunchProgress = (ProgressBar) findViewById(R.id.progressDownloadBar);
|
||||
mLaunchTextStatus = (TextView) findViewById(R.id.progressDownloadText);
|
||||
LinearLayout exitLayout = (LinearLayout) findViewById(R.id.launcherMainExitbtns);
|
||||
switchUsrBtn = (Button) exitLayout.getChildAt(0);
|
||||
logoutBtn = (Button) exitLayout.getChildAt(1);
|
||||
|
||||
leftView = (LinearLayout) findViewById(R.id.launcherMainLeftLayout);
|
||||
mPlayButton = (Button) findViewById(R.id.launcherMainPlayButton);
|
||||
rightView = (ViewGroup) findViewById(R.id.launcherMainRightLayout);
|
||||
|
||||
statusIsLaunching(false);
|
||||
}
|
||||
// DEBUG
|
||||
//new android.support.design.widget.NavigationView(this);
|
||||
|
||||
private String getStr(int id, Object... val) {
|
||||
if (val != null && val.length > 0) {
|
||||
return getResources().getString(id, val);
|
||||
} else {
|
||||
return getResources().getString(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float updateWidthHeight() {
|
||||
float leftRightWidth = (float) CallbackBridge.windowWidth / 100f * 32f;
|
||||
float mPlayButtonWidth = CallbackBridge.windowWidth - leftRightWidth * 2f;
|
||||
LinearLayout.LayoutParams leftRightParams = new LinearLayout.LayoutParams((int) leftRightWidth, (int) Tools.dpToPx(CallbackBridge.windowHeight / 9));
|
||||
LinearLayout.LayoutParams mPlayButtonParams = new LinearLayout.LayoutParams((int) mPlayButtonWidth, (int) Tools.dpToPx(CallbackBridge.windowHeight / 9));
|
||||
leftView.setLayoutParams(leftRightParams);
|
||||
rightView.setLayoutParams(leftRightParams);
|
||||
mPlayButton.setLayoutParams(mPlayButtonParams);
|
||||
|
||||
return leftRightWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void selectTabPage(int pageIndex) {
|
||||
if (tabLayout.getSelectedTabPosition() != pageIndex) {
|
||||
tabLayout.setScrollPosition(pageIndex,0f,true);
|
||||
viewPager.setCurrentItem(pageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void statusIsLaunching(boolean isLaunching) {
|
||||
LinearLayout.LayoutParams reparam = new LinearLayout.LayoutParams((int) updateWidthHeight(), LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
ViewGroup.MarginLayoutParams lmainTabParam = (ViewGroup.MarginLayoutParams) fullTab.getLayoutParams();
|
||||
int launchVisibility = isLaunching ? View.VISIBLE : View.GONE;
|
||||
mLaunchProgress.setVisibility(launchVisibility);
|
||||
mLaunchTextStatus.setVisibility(launchVisibility);
|
||||
lmainTabParam.bottomMargin = reparam.height;
|
||||
leftView.setLayoutParams(reparam);
|
||||
|
||||
switchUsrBtn.setEnabled(!isLaunching);
|
||||
logoutBtn.setEnabled(!isLaunching);
|
||||
mVersionSelector.setEnabled(!isLaunching);
|
||||
canBack = !isLaunching;
|
||||
}
|
||||
}
|
@ -1,86 +1,99 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import android.os.*;
|
||||
import android.support.design.widget.*;
|
||||
import android.support.design.widget.VerticalTabLayout.*;
|
||||
import androidx.core.view.*;
|
||||
import androidx.appcompat.app.*;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.design.widget.VerticalTabLayout.ViewPagerAdapter;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import android.util.*;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.kdt.pojavlaunch.fragments.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
|
||||
import org.lwjgl.glfw.*;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import net.kdt.pojavlaunch.value.*;
|
||||
//import android.support.v7.view.menu.*;
|
||||
//import net.zhuoweizhang.boardwalk.downloader.*;
|
||||
|
||||
import net.kdt.pojavlaunch.fragments.ConsoleFragment;
|
||||
import net.kdt.pojavlaunch.fragments.CrashFragment;
|
||||
import net.kdt.pojavlaunch.fragments.LauncherFragment;
|
||||
import net.kdt.pojavlaunch.prefs.LauncherPreferenceFragment;
|
||||
import net.kdt.pojavlaunch.value.MinecraftAccount;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PojavLauncherActivity extends BaseLauncherActivity
|
||||
{
|
||||
//private FragmentTabHost mTabHost;
|
||||
private LinearLayout fullTab, leftTab;
|
||||
/*
|
||||
private PojavLauncherViewPager viewPager;
|
||||
private VerticalTabLayout tabLayout;
|
||||
*/
|
||||
|
||||
private ViewPager viewPager;
|
||||
private VerticalTabLayout tabLayout;
|
||||
|
||||
private TextView tvUsernameView;
|
||||
private Spinner accountSelector;
|
||||
private ViewPagerAdapter viewPageAdapter;
|
||||
private final Button[] Tabs = new Button[4];
|
||||
private View selected;
|
||||
|
||||
private Button switchUsrBtn, logoutBtn; // MineButtons
|
||||
private ViewGroup leftView, rightView;
|
||||
|
||||
public PojavLauncherActivity() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.launcher_main_v4);
|
||||
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
Toast.makeText(this, "Launcher process id: " + android.os.Process.myPid(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
setContentView(R.layout.launcher_main_v3);
|
||||
// setContentView(R.layout.launcher_main);
|
||||
|
||||
leftTab = findViewById(R.id.launchermain_layout_leftmenu);
|
||||
leftTab.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
CallbackBridge.windowWidth / 4,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
|
||||
fullTab = findViewById(R.id.launchermain_layout_viewpager);
|
||||
tabLayout = findViewById(R.id.launchermainTabLayout);
|
||||
viewPager = findViewById(R.id.launchermainTabPager);
|
||||
selected = findViewById(R.id.viewTabSelected);
|
||||
|
||||
mConsoleView = new ConsoleFragment();
|
||||
mCrashView = new CrashFragment();
|
||||
|
||||
viewPageAdapter = new ViewPagerAdapter(getSupportFragmentManager());
|
||||
viewPageAdapter.addFragment(new LauncherFragment(), R.drawable.ic_menu_news, getString(R.string.mcl_tab_news));
|
||||
viewPageAdapter.addFragment(mConsoleView, R.drawable.ic_menu_java, getString(R.string.mcl_tab_console));
|
||||
viewPageAdapter.addFragment(new LauncherFragment(), 0, getString(R.string.mcl_tab_news));
|
||||
viewPageAdapter.addFragment(mConsoleView, 0, getString(R.string.mcl_tab_console));
|
||||
viewPageAdapter.addFragment(mCrashView, 0, getString(R.string.mcl_tab_crash));
|
||||
viewPageAdapter.addFragment(new LauncherPreferenceFragment(), R.drawable.ic_menu_settings,
|
||||
getString(R.string.mcl_option_settings));
|
||||
viewPageAdapter.addFragment(new LauncherPreferenceFragment(), 0, getString(R.string.mcl_option_settings));
|
||||
|
||||
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
setTabActive(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
viewPager.setAdapter(viewPageAdapter);
|
||||
// tabLayout.setTabMode(VerticalTabLayout.MODE_SCROLLABLE);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
tabLayout.setLastTabAsBottom();
|
||||
|
||||
tvUsernameView = (TextView) findViewById(R.id.launchermain_text_welcome);
|
||||
mTextVersion = (TextView) findViewById(R.id.launcherMainVersionView);
|
||||
|
||||
Tabs[0] = findViewById(R.id.btnTab1);
|
||||
Tabs[1] = findViewById(R.id.btnTab2);
|
||||
Tabs[2] = findViewById(R.id.btnTab3);
|
||||
Tabs[3] = findViewById(R.id.btnTab4);
|
||||
|
||||
|
||||
pickAccount();
|
||||
|
||||
/*
|
||||
@ -128,6 +141,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
accountSelector.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> p1, View p2, int position, long p4) {
|
||||
@ -167,7 +181,6 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
||||
}
|
||||
|
||||
//mAvailableVersions;
|
||||
|
||||
ArrayAdapter<String> adapterVer = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAvailableVersions);
|
||||
adapterVer.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
|
||||
mVersionSelector = (Spinner) findViewById(R.id.launchermain_spinner_version);
|
||||
@ -175,38 +188,21 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
||||
|
||||
mLaunchProgress = (ProgressBar) findViewById(R.id.progressDownloadBar);
|
||||
mLaunchTextStatus = (TextView) findViewById(R.id.progressDownloadText);
|
||||
LinearLayout exitLayout = (LinearLayout) findViewById(R.id.launcherMainExitbtns);
|
||||
switchUsrBtn = (Button) exitLayout.getChildAt(0);
|
||||
logoutBtn = (Button) exitLayout.getChildAt(1);
|
||||
switchUsrBtn = (Button) findViewById(R.id.infoDevBtn);
|
||||
logoutBtn = (Button) findViewById(R.id.switchUserBtn);
|
||||
|
||||
leftView = (LinearLayout) findViewById(R.id.launcherMainLeftLayout);
|
||||
mPlayButton = (Button) findViewById(R.id.launcherMainPlayButton);
|
||||
rightView = (ViewGroup) findViewById(R.id.launcherMainRightLayout);
|
||||
mPlayButton = (Button) findViewById(R.id.launchermainPlayButton);
|
||||
|
||||
statusIsLaunching(false);
|
||||
|
||||
initTabs(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float updateWidthHeight() {
|
||||
float leftRightWidth = (float) CallbackBridge.windowWidth / 100f * 32f;
|
||||
float mPlayButtonWidth = CallbackBridge.windowWidth - leftRightWidth * 2f;
|
||||
LinearLayout.LayoutParams leftRightParams = new LinearLayout.LayoutParams((int) leftRightWidth,
|
||||
(int) Tools.dpToPx(CallbackBridge.windowHeight / 9));
|
||||
LinearLayout.LayoutParams mPlayButtonParams = new LinearLayout.LayoutParams((int) mPlayButtonWidth,
|
||||
(int) Tools.dpToPx(CallbackBridge.windowHeight / 9));
|
||||
leftView.setLayoutParams(leftRightParams);
|
||||
rightView.setLayoutParams(leftRightParams);
|
||||
mPlayButton.setLayoutParams(mPlayButtonParams);
|
||||
|
||||
return leftRightWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void selectTabPage(int pageIndex){
|
||||
if (tabLayout.getSelectedTabPosition() != pageIndex) {
|
||||
tabLayout.setScrollPosition(pageIndex,0f,true);
|
||||
private void selectTabPage(int pageIndex){
|
||||
viewPager.setCurrentItem(pageIndex);
|
||||
}
|
||||
setTabActive(pageIndex);
|
||||
}
|
||||
|
||||
private void pickAccount() {
|
||||
@ -221,19 +217,50 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
||||
}
|
||||
|
||||
public void statusIsLaunching(boolean isLaunching) {
|
||||
LinearLayout.LayoutParams reparam = new LinearLayout.LayoutParams((int) updateWidthHeight(),
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
ViewGroup.MarginLayoutParams lmainTabParam = (ViewGroup.MarginLayoutParams) fullTab.getLayoutParams();
|
||||
int launchVisibility = isLaunching ? View.VISIBLE : View.GONE;
|
||||
mLaunchProgress.setVisibility(launchVisibility);
|
||||
mLaunchTextStatus.setVisibility(launchVisibility);
|
||||
lmainTabParam.bottomMargin = reparam.height;
|
||||
leftView.setLayoutParams(reparam);
|
||||
|
||||
switchUsrBtn.setEnabled(!isLaunching);
|
||||
logoutBtn.setEnabled(!isLaunching);
|
||||
mVersionSelector.setEnabled(!isLaunching);
|
||||
canBack = !isLaunching;
|
||||
}
|
||||
|
||||
public void onTabClicked(View view) {
|
||||
for(int i=0; i<Tabs.length;i++){
|
||||
if(view.getId() == Tabs[i].getId()) {
|
||||
selectTabPage(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setTabActive(int index){
|
||||
for (Button tab : Tabs) {
|
||||
tab.setTypeface(null, Typeface.NORMAL);
|
||||
tab.setTextColor(Color.rgb(220,220,220)); //Slightly less bright white.
|
||||
}
|
||||
Tabs[index].setTypeface(Tabs[index].getTypeface(), Typeface.BOLD);
|
||||
Tabs[index].setTextColor(Color.WHITE);
|
||||
|
||||
//Animating the white bar on the left
|
||||
ValueAnimator animation = ValueAnimator.ofFloat(selected.getY(), Tabs[index].getY()+(Tabs[index].getHeight()-selected.getHeight())/2f);
|
||||
animation.setDuration(250);
|
||||
animation.addUpdateListener(animation1 -> selected.setY((float) animation1.getAnimatedValue()));
|
||||
animation.start();
|
||||
}
|
||||
|
||||
protected void initTabs(int activeTab){
|
||||
final Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//Do something after 100ms
|
||||
selectTabPage(activeTab);
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import android.*;
|
||||
import android.app.Dialog;
|
||||
import android.content.*;
|
||||
import android.content.pm.*;
|
||||
import android.content.res.*;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.*;
|
||||
import android.os.*;
|
||||
|
||||
@ -666,39 +669,30 @@ public class PojavLoginActivity extends BaseActivity
|
||||
}
|
||||
|
||||
public void loginSavedAcc(View view) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
final Dialog accountDialog = new Dialog(PojavLoginActivity.this);
|
||||
|
||||
if (Tools.ENABLE_DEV_FEATURES) {
|
||||
builder.setNegativeButton("Toggle UI v2", new DialogInterface.OnClickListener(){
|
||||
int xScreen = PojavLoginActivity.this.getResources().getDisplayMetrics().widthPixels;
|
||||
int yScreen = PojavLoginActivity.this.getResources().getDisplayMetrics().heightPixels;
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface p1, int p2)
|
||||
{
|
||||
int ver = PojavV2ActivityManager.getLauncherRemakeInt(PojavLoginActivity.this) == 0 ? 1 : 0;
|
||||
PojavV2ActivityManager.setLauncherRemakeVer(PojavLoginActivity.this, ver);
|
||||
Toast.makeText(PojavLoginActivity.this, "Changed to use v" + (ver + 1), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
accountDialog.setContentView(R.layout.simple_account_list_holder);
|
||||
|
||||
|
||||
LinearLayout accountListLayout = accountDialog.findViewById(R.id.accountListLayout);
|
||||
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
|
||||
for (String s : new File(Tools.DIR_ACCOUNT_NEW).list()) {
|
||||
listAdapter.add(s.substring(0, s.length() - 5));
|
||||
}
|
||||
View child = inflater.inflate(R.layout.simple_account_list_item, null);
|
||||
TextView accountName = child.findViewById(R.id.accountName);
|
||||
ImageButton removeButton = child.findViewById(R.id.removeBtn);
|
||||
|
||||
builder.setPositiveButton(android.R.string.cancel, null);
|
||||
builder.setTitle(this.getString(R.string.login_select_account));
|
||||
builder.setSingleChoiceItems(listAdapter, 0, new DialogInterface.OnClickListener(){
|
||||
accountName.setText(s.substring(0, s.length() - 5));
|
||||
|
||||
accountListLayout.addView(child);
|
||||
|
||||
accountName.setOnClickListener(new View.OnClickListener() {
|
||||
final String selectedAccName = accountName.getText().toString();
|
||||
@Override
|
||||
public void onClick(final DialogInterface di, final int selectedIndex) {
|
||||
PopupMenu popup = new PopupMenu(PojavLoginActivity.this, getViewFromList(selectedIndex, ((AlertDialog) di).getListView()));
|
||||
popup.inflate(R.menu.menu_options_account);
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
final String selectedAccName = listAdapter.getItem(selectedIndex);
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_account_select:
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
RefreshListener authListener = new RefreshListener(){
|
||||
@Override
|
||||
@ -708,7 +702,7 @@ public class PojavLoginActivity extends BaseActivity
|
||||
|
||||
@Override
|
||||
public void onSuccess(MinecraftAccount out) {
|
||||
di.dismiss();
|
||||
accountDialog.dismiss();
|
||||
mProfile = out;
|
||||
playProfile(true);
|
||||
}
|
||||
@ -721,15 +715,18 @@ public class PojavLoginActivity extends BaseActivity
|
||||
} else if (acc.accessToken.length() >= 5) {
|
||||
PojavProfile.updateTokens(PojavLoginActivity.this, selectedAccName, authListener);
|
||||
} else {
|
||||
di.dismiss();
|
||||
accountDialog.dismiss();
|
||||
PojavProfile.launch(PojavLoginActivity.this, selectedAccName);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Tools.showError(PojavLoginActivity.this, e);
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.menu_account_remove:
|
||||
}
|
||||
});
|
||||
removeButton.setOnClickListener(new View.OnClickListener() {
|
||||
final String selectedAccName = accountName.getText().toString();
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder2 = new AlertDialog.Builder(PojavLoginActivity.this);
|
||||
builder2.setTitle(selectedAccName);
|
||||
builder2.setMessage(R.string.warning_remove_account);
|
||||
@ -737,23 +734,22 @@ public class PojavLoginActivity extends BaseActivity
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface p1, int p2) {
|
||||
new InvalidateTokenTask(PojavLoginActivity.this)
|
||||
.execute(selectedAccName);
|
||||
listAdapter.remove(selectedAccName);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
new InvalidateTokenTask(PojavLoginActivity.this).execute(selectedAccName);
|
||||
accountListLayout.removeViewsInLayout(0,1);
|
||||
//Resize the window
|
||||
accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int)Math.min((yScreen*0.8), 200 + accountListLayout.getChildCount()*150));
|
||||
}
|
||||
});
|
||||
builder2.setNegativeButton(android.R.string.cancel, null);
|
||||
builder2.show();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
|
||||
accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int)Math.min((yScreen*0.8), 200 + accountListLayout.getChildCount()*150));
|
||||
accountDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
accountDialog.show();
|
||||
}
|
||||
|
||||
private MinecraftAccount loginOffline() {
|
||||
|
@ -101,7 +101,7 @@ public class PojavProfile
|
||||
public static void launch(Activity ctx, Object o) {
|
||||
PojavProfile.setCurrentProfile(ctx, o);
|
||||
|
||||
Intent intent = new Intent(ctx, PojavV2ActivityManager.getLauncherRemakeVer(ctx)); //MCLauncherActivity.class);
|
||||
Intent intent = new Intent(ctx, PojavLauncherActivity.class); //MCLauncherActivity.class);
|
||||
ctx.startActivity(intent);
|
||||
}
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
import android.content.*;
|
||||
|
||||
public class PojavV2ActivityManager
|
||||
{
|
||||
public static String CATEGORY_LAUNCHER = "launcher";
|
||||
public static Class<?> LAUNCHER_V1 = MCLauncherActivity.class;
|
||||
public static Class<?> LAUNCHER_V2 = PojavLauncherActivity.class;
|
||||
|
||||
public static boolean setLauncherRemakeClass(Context context, Class<?> cls) {
|
||||
return setLauncherRemakeVer(context, cls.getName().equals(LAUNCHER_V1.getName()) ? 0 : 1);
|
||||
}
|
||||
|
||||
public static boolean setLauncherRemakeVer(Context context, int i) {
|
||||
Context context2 = context;
|
||||
int i2 = i;
|
||||
if (i2 >= 0 && i2 <= 1) {
|
||||
return getPref(context2).edit().putInt(CATEGORY_LAUNCHER, i2).commit();
|
||||
} else throw new IllegalArgumentException("ver must be 0 or 1");
|
||||
}
|
||||
|
||||
public static int getLauncherRemakeInt(Context context) {
|
||||
if (Tools.ENABLE_DEV_FEATURES) {
|
||||
return getPref(context).getInt(CATEGORY_LAUNCHER, 0);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static Class<?> getLauncherRemakeVer(Context context) {
|
||||
return getLauncherRemakeInt(context) == 0 ? LAUNCHER_V1 : LAUNCHER_V2;
|
||||
}
|
||||
|
||||
private static SharedPreferences getPref(Context ctx) {
|
||||
return ctx.getSharedPreferences("remake", Context.MODE_PRIVATE);
|
||||
}
|
||||
}
|
@ -38,7 +38,7 @@ public class InvalidateTokenTask extends AsyncTask<String, Void, Throwable> {
|
||||
if (result != null) {
|
||||
Tools.showError(ctx, result);
|
||||
}
|
||||
new File(path).delete();
|
||||
new File(Tools.DIR_ACCOUNT_NEW + "/" + path + ".json").delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
app_pojavlauncher/src/main/res/drawable-mdpi/ic_menu_java.png
Executable file
After Width: | Height: | Size: 501 B |
BIN
app_pojavlauncher/src/main/res/drawable-mdpi/ic_menu_news.png
Executable file
After Width: | Height: | Size: 280 B |
BIN
app_pojavlauncher/src/main/res/drawable-mdpi/ic_menu_settings.png
Executable file
After Width: | Height: | Size: 293 B |
BIN
app_pojavlauncher/src/main/res/drawable-mdpi/ic_menu_warning.png
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
app_pojavlauncher/src/main/res/drawable-mdpi/ic_remove.png
Executable file
After Width: | Height: | Size: 506 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 333 B |
@ -1,174 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launchermainFragmentTabView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.0"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/launchermainTabLayout"/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/launchermainTabPager"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressDownloadBar"
|
||||
android:layout_width="match_parent"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_height="10dp"
|
||||
android:layout_above="@id/launchermainFragmentTabView"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_below="@id/progressDownloadBar"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/global_waiting"
|
||||
android:id="@+id/progressDownloadText"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launcherMainLeftLayout"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_alignParentLeft="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lMTVVer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_version"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Spinner
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:id="@+id/launcherMainSelectVersion"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:onClick="launcherMenu"
|
||||
android:text="@string/main_options" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.kdt.mcgui.MineButton
|
||||
android:id="@+id/launcherMainPlayButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_toLeftOf="@id/launcherMainLeftLayout"
|
||||
android:layout_toRightOf="@id/lMTVVer"
|
||||
android:onClick="launchGame"
|
||||
android:text="@string/main_play" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launcherMainRightLayout"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_alignParentRight="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_welcome"
|
||||
android:textSize="12sp"
|
||||
android:id="@+id/launchermain_text_welcome"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:text="@string/global_waiting"
|
||||
android:id="@+id/launcherMainVersionView"
|
||||
android:textSize="12sp"
|
||||
android:gravity="center"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launcherMainExitbtns"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="40dp"
|
||||
android:onClick="mcaccSwitchUser"
|
||||
android:text="@string/main_infodev"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:onClick="mcaccLogout"
|
||||
android:text="@string/main_switchuser"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,209 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launchermain_layout_leftmenu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.0"
|
||||
android:orientation="horizontal"
|
||||
android:background="#1D1D1D">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Spinner
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/launchermain_spinner_account"/>
|
||||
|
||||
<TextView
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="Connected"
|
||||
android:id="@+id/launchermain_text_accountstatus"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.VerticalTabLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/launchermainTabLayout"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launchermain_layout_viewpager"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/launchermainTabPager"
|
||||
android:background="#272727"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressDownloadBar"
|
||||
android:layout_width="match_parent"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_height="10dp"
|
||||
android:layout_above="@id/launchermainFragmentTabView"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_below="@id/progressDownloadBar"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/global_waiting"
|
||||
android:id="@+id/progressDownloadText"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launcherMainLeftLayout"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_alignParentLeft="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lMTVVer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_version"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<Spinner
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:id="@+id/launchermain_spinner_version"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:onClick="launcherMenu"
|
||||
android:text="@string/main_options"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.kdt.mcgui.MineButton
|
||||
android:id="@+id/launcherMainPlayButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_toLeftOf="@id/launcherMainLeftLayout"
|
||||
android:layout_toRightOf="@id/lMTVVer"
|
||||
android:onClick="launchGame"
|
||||
android:text="@string/main_play"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launcherMainRightLayout"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_alignParentRight="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_welcome"
|
||||
android:textSize="12sp"
|
||||
android:id="@+id/launchermain_text_welcome"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:text="@string/global_waiting"
|
||||
android:id="@+id/launcherMainVersionView"
|
||||
android:textSize="12sp"
|
||||
android:gravity="center"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/launcherMainExitbtns"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="40dp"
|
||||
android:onClick="mcaccSwitchUser"
|
||||
android:text="@string/main_infodev"
|
||||
android:textSize="10sp"/>
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:onClick="mcaccLogout"
|
||||
android:text="@string/main_switchuser"
|
||||
android:textSize="10sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
323
app_pojavlauncher/src/main/res/layout/launcher_main_v4.xml
Normal file
@ -0,0 +1,323 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guidelineBottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.8" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guidelineBottom2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.9" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guidelineLeft"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.25" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guidelineMiddle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.625" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guidelineRight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.86" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/launchermain_spinner_account"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:spinnerMode="dropdown"
|
||||
|
||||
app:layout_constraintEnd_toStartOf="@+id/guidelineLeft"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/launchermain_text_accountstatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Connected"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/launchermain_spinner_account" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTab1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
|
||||
android:drawableStart="@drawable/ic_menu_news"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:onClick="onTabClicked"
|
||||
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/mcl_tab_news"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
|
||||
|
||||
app:layout_constraintEnd_toStartOf="@+id/guidelineLeft"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/launchermain_text_accountstatus" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTab2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
|
||||
android:drawableStart="@drawable/ic_menu_java"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:onClick="onTabClicked"
|
||||
android:text="@string/mcl_tab_console"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
|
||||
|
||||
app:layout_constraintEnd_toStartOf="@+id/guidelineLeft"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnTab1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTab3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
|
||||
android:drawableStart="@drawable/ic_menu_warning"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:onClick="onTabClicked"
|
||||
android:text="@string/mcl_tab_crash"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
|
||||
|
||||
app:layout_constraintEnd_toStartOf="@+id/guidelineLeft"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnTab2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTab4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableStart="@drawable/ic_menu_settings"
|
||||
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
|
||||
android:onClick="onTabClicked"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/mcl_option_settings"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="#FFFFFF"
|
||||
|
||||
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guidelineLeft"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/guidelineBottom" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/launchermainTabPager"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="#272727"
|
||||
app:layout_constraintBottom_toTopOf="@+id/guidelineBottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressDownloadBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="10dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/progressDownloadText"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progressDownloadText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="#303030"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/global_waiting"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/guidelineBottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lMTVVer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/main_version"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/guidelineBottom2"
|
||||
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
|
||||
app:layout_constraintTop_toTopOf="@+id/guidelineBottom" />
|
||||
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/launchermain_spinner_version"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/guidelineBottom2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/launchermainPlayButton"
|
||||
app:layout_constraintStart_toEndOf="@+id/lMTVVer"
|
||||
app:layout_constraintTop_toTopOf="@+id/guidelineBottom" />
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="launcherMenu"
|
||||
android:text="@string/main_options"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/launchermainPlayButton"
|
||||
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
|
||||
app:layout_constraintTop_toTopOf="@+id/guidelineBottom2" />
|
||||
|
||||
<com.kdt.mcgui.MineButton
|
||||
android:id="@+id/launchermainPlayButton"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:onClick="launchGame"
|
||||
android:text="@string/main_play"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guidelineMiddle"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="@+id/guidelineMiddle"
|
||||
app:layout_constraintTop_toTopOf="@+id/guidelineBottom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/launchermain_text_welcome"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_welcome"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/launchermainPlayButton"
|
||||
app:layout_constraintTop_toTopOf="@+id/guidelineBottom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/launcherMainVersionView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/global_waiting"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/launchermain_text_welcome"
|
||||
app:layout_constraintStart_toStartOf="@+id/launchermain_text_welcome"
|
||||
app:layout_constraintTop_toBottomOf="@+id/launchermain_text_welcome" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/infoDevBtn"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="mcaccSwitchUser"
|
||||
android:text="@string/main_infodev"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
|
||||
app:layout_constraintStart_toEndOf="@+id/launchermainPlayButton"
|
||||
app:layout_constraintTop_toTopOf="@+id/guidelineBottom2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/switchUserBtn"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="mcaccLogout"
|
||||
android:text="@string/main_switchuser"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guidelineRight"
|
||||
app:layout_constraintTop_toTopOf="@+id/guidelineBottom2" />
|
||||
|
||||
<View
|
||||
android:id="@+id/viewTabSelected"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="30dp"
|
||||
|
||||
android:background="@android:color/white"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btnTab1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/launchermain_text_accountstatus" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:background="#424242"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextViewTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
|
||||
android:text="@string/login_select_account"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/TextViewTitle">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/accountListLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
|
||||
|
||||
|
||||
android:orientation="vertical"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
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="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accountName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
|
||||
android:text="Name Placeholder"
|
||||
|
||||
app:layout_constraintEnd_toStartOf="@+id/removeBtn"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/removeBtn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingStart="10dp"
|
||||
|
||||
android:paddingEnd="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/accountName"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_remove" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -4,7 +4,6 @@
|
||||
<item>@string/mcl_option_modinstall</item>
|
||||
<item>@string/mcl_option_modinstallwitharg</item>
|
||||
<item>@string/mcl_option_customcontrol</item>
|
||||
<item>@string/mcl_option_settings</item>
|
||||
<item>@string/mcl_option_about</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|