Removed unecessary project info sheet

This commit is contained in:
Akash Yadav
2022-01-02 13:50:02 +05:30
parent 6ba48ca4da
commit cc8bceb193
5 changed files with 15 additions and 147 deletions
+1
View File
@@ -12,6 +12,7 @@
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/activity_designer.xml" value="0.264" />
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/activity_editor.xml" value="0.20512820512820512" />
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/layout_about_items.xml" value="0.20512820512820512" />
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/menu/menu_editor.xml" value="0.20512820512820512" />
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/menu/menu_editor_nav.xml" value="0.20512820512820512" />
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/common/src/main/res/layout/layout_color_picker.xml" value="0.264" />
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/xml-inflater/src/main/res/drawable/test.xml" value="0.1675925925925926" />
@@ -72,7 +72,6 @@ import com.itsaky.androidide.fragments.EditorFragment;
import com.itsaky.androidide.fragments.FileTreeFragment;
import com.itsaky.androidide.fragments.sheets.OptionsListFragment;
import com.itsaky.androidide.fragments.sheets.ProgressSheet;
import com.itsaky.androidide.fragments.sheets.ProjectInfoSheet;
import com.itsaky.androidide.fragments.sheets.TextSheetFragment;
import com.itsaky.androidide.handlers.BuildServiceHandler;
import com.itsaky.androidide.handlers.FileOptionsHandler;
@@ -147,7 +146,7 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
private FileTreeFragment mFileTreeFragment;
private EditorFragment mCurrentFragment;
public static File mCurrentFile;
private TreeNode mLastHolded;
private TreeNode mLastHeld;
private CodeEditor buildView;
private CodeEditor logView;
private RecyclerView diagnosticList;
@@ -166,7 +165,6 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
private TextSheetFragment mDaemonStatusFragment;
private OptionsListFragment mFileOptionsFragment;
private ProgressSheet mSearchingProgress;
private ProjectInfoSheet mProjectInfoSheet;
private AlertDialog mFindInProjectDialog;
private static final String TAG_FILE_OPTIONS_FRAGMENT = "file_options_fragment";
@@ -174,15 +172,15 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
private static final org.eclipse.lsp4j.Range Range_ofZero = new org.eclipse.lsp4j.Range (new Position (0, 0), new Position (0, 0));
private static final int ACTIONID_CLOSE = 100;
private static final int ACTIONID_OTHERS = 101;
private static final int ACTIONID_ALL = 102;
private static final int ACTION_ID_CLOSE = 100;
private static final int ACTION_ID_OTHERS = 101;
private static final int ACTION_ID_ALL = 102;
public static final String EXTRA_PROJECT = "project";
private ActivityResultLauncher<Intent> mUIDesignerLauncher;
private LogReceiver mLogReceiver = new LogReceiver ().setLogListener (line -> appendApkLog (line));
private final LogReceiver mLogReceiver = new LogReceiver ().setLogListener (this::appendApkLog);
/**
* MenuItem(s) that are related to the build process
@@ -458,10 +456,6 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
if (d != null) {
d.show ();
}
} else if (id == R.id.menuEditor_projectInfo) {
if (!getProjectInfoSheet ().isShowing ()) {
getProjectInfoSheet ().show (getSupportFragmentManager (), "project_info_sheet");
}
} else if (id == R.id.menuEditor_viewLayout && mCurrentFile != null) {
previewLayout ();
}
@@ -810,22 +804,12 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
super.loadFragment (fragment, mBinding.editorFrameLayout.getId ());
}
public ProjectInfoSheet getProjectInfoSheet () {
return mProjectInfoSheet == null ? createProjectInfoSheet () : mProjectInfoSheet;
}
public ProjectInfoSheet createProjectInfoSheet () {
mProjectInfoSheet = new ProjectInfoSheet ();
mProjectInfoSheet.setProject (mIDEProject);
return mProjectInfoSheet;
}
public FileTreeFragment getFileTreeFragment () {
return mFileTreeFragment;
}
public TreeNode getLastHoldTreeNode () {
return mLastHolded;
return mLastHeld;
}
public OptionsListFragment getFileOptionsFragment () {
@@ -987,7 +971,7 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
@Override
public void showFileOptions (File thisFile, TreeNode node) {
mLastHolded = node;
mLastHeld = node;
getFileOptionsFragment (thisFile).show (getSupportFragmentManager (), TAG_FILE_OPTIONS_FRAGMENT);
}
@@ -1457,9 +1441,9 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
}
private void createQuickActions () {
ActionItem closeThis = new ActionItem (ACTIONID_CLOSE, getString (R.string.action_closeThis), R.drawable.ic_close_this);
ActionItem closeOthers = new ActionItem (ACTIONID_OTHERS, getString (R.string.action_closeOthers), R.drawable.ic_close_others);
ActionItem closeAll = new ActionItem (ACTIONID_ALL, getString (R.string.action_closeAll), R.drawable.ic_close_all);
ActionItem closeThis = new ActionItem (ACTION_ID_CLOSE, getString (R.string.action_closeThis), R.drawable.ic_close_this);
ActionItem closeOthers = new ActionItem (ACTION_ID_OTHERS, getString (R.string.action_closeOthers), R.drawable.ic_close_others);
ActionItem closeAll = new ActionItem (ACTION_ID_ALL, getString (R.string.action_closeAll), R.drawable.ic_close_all);
mTabCloseAction = new QuickAction (this, QuickAction.HORIZONTAL);
mTabCloseAction.addActionItem (closeThis, closeOthers, closeAll);
mTabCloseAction.setColorRes (R.color.tabAction_background);
@@ -1469,16 +1453,16 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
ActionItem item = __;
final int id = item.getActionId ();
saveAll ();
if (id == ACTIONID_CLOSE) {
if (id == ACTION_ID_CLOSE) {
closeFile (mBinding.tabs.getSelectedTabPosition ());
}
if (id == ACTIONID_OTHERS) {
if (id == ACTION_ID_OTHERS) {
closeOthers ();
closeOthers ();
}
if (id == ACTIONID_ALL) {
if (id == ACTION_ID_ALL) {
closeAll ();
}
});
@@ -1,112 +0,0 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.androidide.fragments.sheets;
import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.DrawableRes;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.bumptech.glide.Glide;
import com.itsaky.androidide.adapters.ModuleInfoAdapter;
import com.itsaky.androidide.databinding.LayoutProjectDetailsBinding;
import com.itsaky.androidide.project.IDEProject;
import java.io.File;
import java.util.Locale;
public class ProjectInfoSheet extends BaseBottomSheetFragment {
private LayoutProjectDetailsBinding binding;
private IDEProject project;
@Override
@SuppressLint("SetTextI18n")
protected void bind(LinearLayout container) {
binding = LayoutProjectDetailsBinding.inflate(getLayoutInflater());
container.addView(binding.getRoot());
setShowShadow(false);
boolean noProject = project == null;
if(noProject) {
binding.emptyView.setVisibility(View.VISIBLE);
binding.detailsContainer.setVisibility(View.GONE);
} else {
binding.emptyView.setVisibility(View.GONE);
binding.detailsContainer.setVisibility(View.VISIBLE);
}
if(!noProject) {
boolean iconInvisible = false;
if(project.iconPath != null) {
File icon = new File(project.iconPath);
if(icon.exists()) {
Glide.with(getContext().getApplicationContext()).load(icon).into(binding.appIcon);
} else iconInvisible = true;
} else iconInvisible = true;
binding.appIcon.setVisibility(iconInvisible ? View.INVISIBLE : View.VISIBLE);
String name = project.displayName.trim();
name = name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1);
binding.projectName.setText(name);
// Not sure if we would get line height without setting text
binding.projectSummary.setText("Getting info");
final int lineHeight = binding.projectSummary.getLineHeight();
SpannableStringBuilder summaryBuilder = new SpannableStringBuilder();
summaryBuilder.append(" ", createSpan(com.itsaky.androidide.R.drawable.ic_package, lineHeight), SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
summaryBuilder.append(" ");
summaryBuilder.append(getString(com.itsaky.androidide.R.string.msg_module_count, project.modules.size()));
summaryBuilder.append("\n");
summaryBuilder.append(" ", createSpan(com.itsaky.androidide.R.drawable.ic_run, lineHeight), SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
summaryBuilder.append(" ");
summaryBuilder.append(getString(com.itsaky.androidide.R.string.msg_task_count, project.tasks.size()));
binding.projectSummary.setText(summaryBuilder);
binding.modulesList.setLayoutManager(new LinearLayoutManager(getContext()));
binding.modulesList.setAdapter(new ModuleInfoAdapter(project.modules));
}
}
private ImageSpan createSpan(@DrawableRes int id, int lineHeight) {
Drawable image = ContextCompat.getDrawable(getContext(), id);
image.setBounds(0, 0, lineHeight, lineHeight);
image.setAlpha(180);
return new ImageSpan(image);
}
@Override
protected boolean shouldHideTitle() {
return true;
}
public ProjectInfoSheet setProject(IDEProject project) {
this.project = project;
return this;
}
}
@@ -85,7 +85,7 @@ public class BuildServiceHandler extends IDEHandler implements BuildListener {
public void onProjectLoaded(IDEProject project, Optional<IDEModule> appModule) {
project.iconPath = provider.provideAndroidProject().getIconPath();
activity().setIDEProject(project);
activity().createProjectInfoSheet(); // Recreate sheet, even if already created. Just to update its contents
if(appModule.isPresent()) {
IDEModule app = appModule.get();
activity().setStatus(activity().getString(R.string.msg_starting_completion));
-5
View File
@@ -153,9 +153,4 @@
app:showAsAction="never"/>
</menu>
</item>
<item
android:icon="@drawable/ic_info"
android:id="@+id/menuEditor_projectInfo"
android:title="@string/menu_project_info"
app:showAsAction="ifRoom"/>
</menu>