summaryrefslogtreecommitdiff
path: root/android/sdremote
diff options
context:
space:
mode:
authorArtur Dryomov <artur.dryomov@gmail.com>2013-07-30 19:44:47 +0300
committerArtur Dryomov <artur.dryomov@gmail.com>2013-07-30 23:52:02 +0300
commite291784e0ca450c25f9dd691234c57f753d648dc (patch)
tree7af5e0720878247f7bb6da46bf8a7ae7f42c3e35 /android/sdremote
parent0a483508689c08d57feb5db32997125727f0e50d (diff)
Fix tiny source code issues.
* Add headers and footers. * Remove unused resources. * Fix classes usage. Change-Id: Id9580f21709b11077e46393c2e2cf8d911ce0650
Diffstat (limited to 'android/sdremote')
-rw-r--r--android/sdremote/res/drawable/background_pager_slide.xml17
-rw-r--r--android/sdremote/res/layout/fragment_slides_pager.xml2
-rw-r--r--android/sdremote/res/layout/view_grid_slide.xml1
-rw-r--r--android/sdremote/res/layout/view_pager_slide.xml1
-rw-r--r--android/sdremote/res/values/dimens.xml1
-rw-r--r--android/sdremote/res/values/strings.xml3
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java16
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java19
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java5
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java31
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java2
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java10
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/TimerSettingDialog.java10
13 files changed, 65 insertions, 53 deletions
diff --git a/android/sdremote/res/drawable/background_pager_slide.xml b/android/sdremote/res/drawable/background_pager_slide.xml
deleted file mode 100644
index c65e4249ef1e..000000000000
--- a/android/sdremote/res/drawable/background_pager_slide.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
-
- <solid
- android:color="@android:color/transparent" />
-
- <stroke
- android:width="3dp"
- android:color="@color/stroke_pager_slide"/>
-
- <padding
- android:left="0dp"
- android:top="1dp"
- android:right="0dp"
- android:bottom="2dp"/>
-
-</shape> \ No newline at end of file
diff --git a/android/sdremote/res/layout/fragment_slides_pager.xml b/android/sdremote/res/layout/fragment_slides_pager.xml
index 20b43365dcf7..e51518dfda44 100644
--- a/android/sdremote/res/layout/fragment_slides_pager.xml
+++ b/android/sdremote/res/layout/fragment_slides_pager.xml
@@ -40,7 +40,7 @@
android:textStyle="bold"
android:textColor="@color/background_header"
android:drawableBottom="@drawable/underline_header"
- android:drawablePadding="4dp"
+ android:drawablePadding="@dimen/padding_header_underline"
android:paddingLeft="@dimen/padding_header"
android:paddingTop="@dimen/padding_header"
android:gravity="left"
diff --git a/android/sdremote/res/layout/view_grid_slide.xml b/android/sdremote/res/layout/view_grid_slide.xml
index 2cda3bfe196d..a79ca3e80af9 100644
--- a/android/sdremote/res/layout/view_grid_slide.xml
+++ b/android/sdremote/res/layout/view_grid_slide.xml
@@ -9,6 +9,7 @@
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:background="@drawable/background_grid_slide"
+ android:contentDescription="@string/description_grid_slide"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
diff --git a/android/sdremote/res/layout/view_pager_slide.xml b/android/sdremote/res/layout/view_pager_slide.xml
index 6ca8f916ea89..6b2dc4e3d3e8 100644
--- a/android/sdremote/res/layout/view_pager_slide.xml
+++ b/android/sdremote/res/layout/view_pager_slide.xml
@@ -2,5 +2,6 @@
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/image_slide_preview"
android:scaleType="fitCenter"
+ android:contentDescription="@string/description_pager_slide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/> \ No newline at end of file
diff --git a/android/sdremote/res/values/dimens.xml b/android/sdremote/res/values/dimens.xml
index bedf4e14f28a..9739e1548ec9 100644
--- a/android/sdremote/res/values/dimens.xml
+++ b/android/sdremote/res/values/dimens.xml
@@ -10,7 +10,6 @@
<dimen name="padding_slides_pager">16dp</dimen>
<dimen name="padding_slide">4dp</dimen>
<dimen name="padding_header_underline">4dp</dimen>
- <dimen name="padding_slides_pager_layout">8dp</dimen>
<dimen name="padding_header">8dp</dimen>
<dimen name="padding_slide_notes">8dp</dimen>
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 02c0160f6ff2..2f5117af977d 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -46,4 +46,7 @@
<item quantity="other">%d minutes left</item>
</plurals>
+ <string name="description_pager_slide">Slide preview</string>
+ <string name="description_grid_slide">Slide preview</string>
+
</resources>
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java
index 279eaae89d63..377f596d13f5 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java
@@ -9,11 +9,12 @@
package org.libreoffice.impressremote.activity;
import android.os.Bundle;
-import android.support.v4.app.FragmentTransaction;
+import android.support.v4.app.Fragment;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import org.libreoffice.impressremote.fragment.ComputerConnectionFragment;
+import org.libreoffice.impressremote.util.FragmentOperator;
import org.libreoffice.impressremote.util.Intents;
import org.libreoffice.impressremote.communication.Server;
@@ -23,21 +24,18 @@ public class ComputerConnectionActivity extends SherlockFragmentActivity {
super.onCreate(savedInstanceState);
setUpHomeButton();
-
- setUpComputerConnectionFragment(extractReceivedComputer());
+ setUpFragment();
}
private void setUpHomeButton() {
getSupportActionBar().setHomeButtonEnabled(true);
}
- private void setUpComputerConnectionFragment(Server aComputer) {
- FragmentTransaction aTransaction = getSupportFragmentManager().beginTransaction();
-
- aTransaction.replace(android.R.id.content, ComputerConnectionFragment
- .newInstance(aComputer));
+ private void setUpFragment() {
+ Server aComputer = extractReceivedComputer();
+ Fragment aFragment = ComputerConnectionFragment.newInstance(aComputer);
- aTransaction.commit();
+ FragmentOperator.addFragment(this, aFragment);
}
private Server extractReceivedComputer() {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java
index 372e49bdb947..5ff79ac1b7a1 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java
@@ -34,10 +34,10 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement
}
private void setUpActionBar() {
- View aView = buildCustomActionBarView();
- ActionBar.LayoutParams aLayoutParams = buildCustomActionBarLayoutParams();
+ View aActionBarView = buildCustomActionBarView();
+ ActionBar.LayoutParams aActionBarParams = buildCustomActionBarLayoutParams();
- getSupportActionBar().setCustomView(aView, aLayoutParams);
+ getSupportActionBar().setCustomView(aActionBarView, aActionBarParams);
getCancelButton().setOnClickListener(this);
getSaveButton().setOnClickListener(this);
@@ -45,8 +45,7 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement
private View buildCustomActionBarView() {
Context aContext = getSupportActionBar().getThemedContext();
- LayoutInflater aInflater = (LayoutInflater) aContext.getSystemService(
- LAYOUT_INFLATER_SERVICE);
+ LayoutInflater aInflater = LayoutInflater.from(aContext);
return aInflater.inflate(R.layout.action_bar_computer_creation, null);
}
@@ -90,11 +89,10 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement
}
if (TextUtils.isEmpty(aName)) {
- finish(aIpAddress, aIpAddress);
- }
- else {
- finish(aIpAddress, aName);
+ aName = aIpAddress;
}
+
+ finish(aIpAddress, aName);
}
private String getText(EditText aEdit) {
@@ -114,8 +112,7 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement
}
private void finish(String aIpAddress, String aName) {
- Intent aIntent = Intents
- .buildComputerCreationResultIntent(aIpAddress, aName);
+ Intent aIntent = Intents.buildComputerCreationResultIntent(aIpAddress, aName);
setResult(Activity.RESULT_OK, aIntent);
finish();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java
index 5b74de37091e..8d3dc634a80b 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java
@@ -27,15 +27,14 @@ public class LicensesActivity extends SherlockActivity {
setContentView(R.layout.activity_licenses);
setUpHomeButton();
-
- setUpLicenses();
+ setUpContent();
}
private void setUpHomeButton() {
getSupportActionBar().setHomeButtonEnabled(true);
}
- private void setUpLicenses() {
+ private void setUpContent() {
getLicensesView().loadUrl(buildLicensesUri());
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
index 06967d1be6fd..f739394c3a32 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
@@ -20,6 +20,7 @@ import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.content.LocalBroadcastManager;
+import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
@@ -167,8 +168,10 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
return;
}
- getSupportActionBar().setTitle(buildSlideShowProgress());
- getSupportActionBar().setSubtitle(buildSlideShowTimerProgress());
+ ActionBar aActionBar = getSupportActionBar();
+
+ aActionBar.setTitle(buildSlideShowProgress());
+ aActionBar.setSubtitle(buildSlideShowTimerProgress());
}
private boolean isServiceBound() {
@@ -307,23 +310,31 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
Timer aTimer = mCommunicationService.getSlideShow().getTimer();
if (aTimer.isSet()) {
- int aTimerLength = aTimer.getMinutesLeft();
-
- DialogFragment aFragment = TimerEditingDialog.newInstance(aTimerLength);
- aFragment.show(getSupportFragmentManager(), TimerEditingDialog.TAG);
-
- pauseTimer();
+ callEditingTimer(aTimer);
}
else {
- DialogFragment aFragment = TimerSettingDialog.newInstance();
- aFragment.show(getSupportFragmentManager(), TimerSettingDialog.TAG);
+ callSettingTimer();
}
}
+ private void callEditingTimer(Timer aTimer) {
+ int aTimerLength = aTimer.getMinutesLeft();
+
+ DialogFragment aFragment = TimerEditingDialog.newInstance(aTimerLength);
+ aFragment.show(getSupportFragmentManager(), TimerEditingDialog.TAG);
+
+ pauseTimer();
+ }
+
private void pauseTimer() {
mCommunicationService.getSlideShow().getTimer().pause();
}
+ private void callSettingTimer() {
+ DialogFragment aFragment = TimerSettingDialog.newInstance();
+ aFragment.show(getSupportFragmentManager(), TimerSettingDialog.TAG);
+ }
+
private void stopSlideShow() {
mCommunicationService.getTransmitter().stopPresentation();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java
index 25e2819a7c4c..dcfd6efc5ae1 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java
@@ -50,7 +50,7 @@ public class SlidesGridFragment extends SherlockFragment implements ServiceConne
}
private void bindService() {
- Intent aServiceIntent = new Intent(getActivity(), CommunicationService.class);
+ Intent aServiceIntent = Intents.buildCommunicationServiceIntent(getActivity());
getActivity().bindService(aServiceIntent, this, Context.BIND_AUTO_CREATE);
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java
index accfd8bdeaaf..ed7c853de928 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java
@@ -1,3 +1,11 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote.fragment;
import java.util.concurrent.TimeUnit;
@@ -134,3 +142,5 @@ public class TimerEditingDialog extends SherlockDialogFragment implements TimePi
aDialog.updateTime(0, 0);
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerSettingDialog.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerSettingDialog.java
index 99374f817bfe..5375de87707f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerSettingDialog.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerSettingDialog.java
@@ -1,3 +1,11 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote.fragment;
import java.util.concurrent.TimeUnit;
@@ -70,3 +78,5 @@ public class TimerSettingDialog extends SherlockDialogFragment implements TimePi
LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(aIntent);
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */