-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added pin layout screens for PSLab v6 #2625
Open
samruddhi-Rahegaonkar
wants to merge
1
commit into
fossasia:development
Choose a base branch
from
samruddhi-Rahegaonkar:Pin_Layout_v6
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ | |
import io.pslab.fragment.HomeFragment; | ||
import io.pslab.fragment.InstrumentsFragment; | ||
import io.pslab.fragment.PSLabPinLayoutFragment; | ||
import io.pslab.fragment.PSLabPinLayoutFragment_v6; | ||
import io.pslab.others.CustomSnackBar; | ||
import io.pslab.others.CustomTabService; | ||
import io.pslab.others.InitializationVariable; | ||
|
@@ -86,6 +87,7 @@ public class MainActivity extends AppCompatActivity { | |
private static final String TAG_INSTRUMENTS = "instruments"; | ||
private static final String TAG_ABOUTUS = "aboutUs"; | ||
private static final String TAG_PINLAYOUT = "pinLayout"; | ||
private static final String TAG_PINLAYOUT_V6 = "PINLAYOUTV6"; | ||
private static final String TAG_FAQ = "faq"; | ||
private static String CURRENT_TAG = TAG_INSTRUMENTS; | ||
private String[] activityTitles; | ||
|
@@ -337,6 +339,7 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) { | |
OssLicensesMenuActivity.setActivityTitle(getString(R.string.third_party_libs)); | ||
startActivity(new Intent(MainActivity.this, OssLicensesMenuActivity.class)); | ||
break; | ||
|
||
default: | ||
navItemIndex = 0; | ||
} | ||
|
@@ -429,14 +432,23 @@ public boolean onOptionsItemSelected(MenuItem item) { | |
case R.id.menu_pslab_disconnected: | ||
attemptToConnectPSLab(); | ||
break; | ||
case R.id.menu_pslab_layout_front: | ||
case R.id.menu_pslab_layout_front_v5: | ||
PSLabPinLayoutFragment.frontSide = true; | ||
displayPSLabPinLayout(); | ||
displayPSLabPinLayout(TAG_PINLAYOUT); | ||
break; | ||
case R.id.menu_pslab_layout_back: | ||
case R.id.menu_pslab_layout_back_v5: | ||
PSLabPinLayoutFragment.frontSide = false; | ||
displayPSLabPinLayout(); | ||
displayPSLabPinLayout(TAG_PINLAYOUT); | ||
break; | ||
case R.id.menu_pslab_layout_front_v6: | ||
PSLabPinLayoutFragment_v6.topside=true; | ||
displayPSLabPinLayout(TAG_PINLAYOUT_V6); | ||
break; | ||
case R.id.menu_pslab_layout_back_v6: | ||
PSLabPinLayoutFragment_v6.topside=false; | ||
displayPSLabPinLayout(TAG_PINLAYOUT_V6); | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
@@ -465,20 +477,36 @@ private void attemptToConnectPSLab() { | |
} | ||
} | ||
|
||
private void displayPSLabPinLayout() { | ||
AsCress marked this conversation as resolved.
Show resolved
Hide resolved
|
||
CURRENT_TAG = TAG_PINLAYOUT; | ||
private void displayPSLabPinLayout(String fragmentTag) { | ||
CURRENT_TAG = fragmentTag; | ||
navigationView.getMenu().getItem(navItemIndex).setChecked(false); | ||
setToolbarTitle(getResources().getString(R.string.pslab_pinlayout)); | ||
|
||
// Set toolbar title based on the fragment tag | ||
if (fragmentTag.equals(TAG_PINLAYOUT)) { | ||
setToolbarTitle(getResources().getString(R.string.pslab_pinlayout)); | ||
} else if (fragmentTag.equals(TAG_PINLAYOUT_V6)) { | ||
setToolbarTitle(getResources().getString(R.string.pslab_pinlayout_v6)); | ||
} | ||
|
||
Runnable mPendingRunnable = new Runnable() { | ||
@Override | ||
public void run() { | ||
Fragment fragment = PSLabPinLayoutFragment.newInstance(); | ||
Fragment fragment; | ||
if (fragmentTag.equals(TAG_PINLAYOUT)) { | ||
fragment = PSLabPinLayoutFragment.newInstance(); | ||
} else if (fragmentTag.equals(TAG_PINLAYOUT_V6)) { | ||
fragment = PSLabPinLayoutFragment_v6.newInstance(); | ||
} else { | ||
return; // Exit if no valid tag is provided | ||
} | ||
|
||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); | ||
fragmentTransaction.setCustomAnimations(R.anim.fade_in, R.anim.fade_out) | ||
.replace(R.id.frame, fragment, TAG_PINLAYOUT) | ||
.replace(R.id.frame, fragment, fragmentTag) | ||
.commitAllowingStateLoss(); | ||
} | ||
}; | ||
|
||
mHandler.post(mPendingRunnable); | ||
} | ||
|
||
|
@@ -561,7 +589,6 @@ public void onReceive(Context context, Intent intent) { | |
} | ||
} | ||
}; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The file MainActivity.java has formatting issues. Kindly reformat the whole file as we have discussed earlier as well (Ctrl + A, Ctrl + Alt + L) |
||
@Override | ||
protected void onNewIntent(Intent intent) { | ||
super.onNewIntent(intent); | ||
|
@@ -582,7 +609,6 @@ protected void onNewIntent(Intent intent) { | |
} | ||
} | ||
} | ||
|
||
@Override | ||
protected void onPostResume() { | ||
super.onPostResume(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.