Skip to content

Commit

Permalink
Syncing repos. (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
CesarValiente authored Jul 20, 2020
1 parent 76f9c96 commit 0010050
Show file tree
Hide file tree
Showing 173 changed files with 1,335 additions and 3,532 deletions.
40 changes: 1 addition & 39 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,48 +37,10 @@ captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
.idea/

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

45 changes: 18 additions & 27 deletions CompanionPane/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,35 @@
*/

apply plugin: 'com.android.application'
apply from: '../quality/pmd_android.gradle'
apply from: '../quality/checkstyle_android.gradle'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.microsoft.device.display.samples.complementarycontext"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
testInstrumentationRunner config.testInstrumentationRunner
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'

implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'

implementation 'com.microsoft.device:dualscreen-layout:0.9.2'

implementation kotlinDependencies.kotlinStdlib
implementation androidxDependencies.appCompat
implementation androidxDependencies.constraintLayout
implementation androidxDependencies.recyclerView
implementation androidxDependencies.cardView
implementation androidxDependencies.viewPager2

implementation microsoftDependencies.dualScreenLayout

testImplementation testDependencies.junit
androidTestImplementation instrumentationTestDependencies.junit
androidTestImplementation instrumentationTestDependencies.espressoCore
}
21 changes: 0 additions & 21 deletions CompanionPane/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertEquals("com.microsoft.complementarycontext", appContext.getPackageName());
assertEquals("com.microsoft.device.display.samples.complementarycontext", appContext.getPackageName());
}
}
1 change: 0 additions & 1 deletion CompanionPane/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name=".CompanionPaneApp"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup">
<activity
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,77 +22,60 @@
import com.microsoft.device.display.samples.complementarycontext.adapters.SlidesAdapter;
import com.microsoft.device.display.samples.complementarycontext.model.DataProvider;
import com.microsoft.device.dualscreen.layout.ScreenHelper;
import com.microsoft.device.dualscreen.layout.ScreenModeListener;


public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

((CompanionPaneApp) getApplication()).getSurfaceDuoScreenManager()
.addScreenModeListener(new ScreenModeListener() {
private void setupViewPager(ViewPager2 viewPager) {
SlidesAdapter slidesAdapter= new SlidesAdapter();
slidesAdapter.submitList(DataProvider.getSlides());
viewPager.setAdapter(slidesAdapter);
}

@Override
public void onSwitchToSingleScreenMode() {
final ViewPager2 slidesPager= findViewById(R.id.slides_pager);
setupViewPager(slidesPager);
}

@Override
public void onSwitchToDualScreenMode() {
final ViewPager2 slidesPager= findViewById(R.id.slides_pager);
setupViewPager(slidesPager);

// Handle DualScreenEndLayout Toolbar visibility
Toolbar toolbar = findViewById(R.id.dual_screen_end_toolbar);
switch (ScreenHelper.getCurrentRotation(MainActivity.this)) {
case Surface.ROTATION_0:
case Surface.ROTATION_180:
toolbar.setVisibility(View.VISIBLE);
break;
case Surface.ROTATION_90:
case Surface.ROTATION_270:
toolbar.setVisibility(View.GONE);
break;
}

final RecyclerView notesRecyclerView = findViewById(R.id.notes_recycler_view);
notesRecyclerView.setLayoutManager(new LinearLayoutManager(MainActivity.this));
final NotesAdapter notesAdapter = new NotesAdapter();
notesAdapter.submitList(DataProvider.getSlides());
notesRecyclerView.setAdapter(notesAdapter);
notesAdapter.setSlidesPager(slidesPager);
if (!ScreenHelper.isDualMode(this)) {
final ViewPager2 slidesPager = findViewById(R.id.slides_pager);
setupViewPager(slidesPager);
} else {
final ViewPager2 slidesPager = findViewById(R.id.slides_pager);
setupViewPager(slidesPager);

slidesPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
}
// Handle DualScreenEndLayout Toolbar visibility
Toolbar toolbar = findViewById(R.id.dual_screen_end_toolbar);
switch (ScreenHelper.getCurrentRotation(this)) {
case Surface.ROTATION_0:
case Surface.ROTATION_180:
toolbar.setVisibility(View.VISIBLE);
break;
case Surface.ROTATION_90:
case Surface.ROTATION_270:
toolbar.setVisibility(View.GONE);
break;
default:
break;
}

@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
notesRecyclerView.scrollToPosition(position);
final RecyclerView notesRecyclerView = findViewById(R.id.notes_recycler_view);
notesRecyclerView.setLayoutManager(new LinearLayoutManager(this));
final NotesAdapter notesAdapter = new NotesAdapter();
notesAdapter.submitList(DataProvider.getSlides());
notesRecyclerView.setAdapter(notesAdapter);
notesAdapter.setSlidesPager(slidesPager);

NotesAdapter.oldSelectionPosition = NotesAdapter.selectionPosition;
NotesAdapter.selectionPosition = position;
notesAdapter.notifyItemChanged(NotesAdapter.oldSelectionPosition);
notesAdapter.notifyItemChanged(position);
}
slidesPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
notesRecyclerView.scrollToPosition(position);

@Override
public void onPageScrollStateChanged(int state) {
super.onPageScrollStateChanged(state);
}
});
notesAdapter.setOldSelectionPosition(notesAdapter.getSelectionPosition());
notesAdapter.setSelectionPosition(position);
notesAdapter.notifyItemChanged(notesAdapter.getOldSelectionPosition());
notesAdapter.notifyItemChanged(position);
}
});
}
}

private void setupViewPager(ViewPager2 viewPager) {
SlidesAdapter slidesAdapter = new SlidesAdapter();
slidesAdapter.submitList(DataProvider.getSlides());
viewPager.setAdapter(slidesAdapter);
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 0010050

Please sign in to comment.