5,595,000 Members 38,936 Now Online
XDA Developers Android and Mobile Development Forum

[TUT] Add rotation on your own to Netflix apps (and other apps)

Tip us?
 
Dblfstr
Old
(Last edited by Dblfstr; 13th September 2011 at 02:11 PM.)
#1  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
Default [TUT] Add rotation on your own to Netflix apps (and other apps)

This is just a simple tutorial about enabling screen rotation to apps that do not rotate automatically when you turn your device. It is really a TUT on how to open an apk and edit the androidmanifest.xml file. Pretty simple.


Quote:
Easy:

1. Decompile the Application.apk with apktool
2. Edit the androidmanifest with Notepad++
3. Build the Application.apk with apktool
4. Sign the apk with autosign.
Detailed:

You will need some tools:
************************************************** **********
Android SDK: http://developer.android.com/sdk/index.html
APK Tool: http://code.google.com/p/android-apktool/
Notepad++: http://notepad-plus-plus.org/
A signing tool: Google "auto-sign apk"
An archiving tool: Plenty of them out there cable of .zip files
After you get this figured out, move on to step 1.
************************************************** **********

I do this from my desktop, so this is written as such.

Step 1. Decompile the Application.apk with apktool
__________________________________________________ _________
Quote:
A. Open cmd.exe

B. Type apktool d C:/users/desktop/Netflix1.4.apk

(this refers to your desktop, so type the correct address for YOURS. However, I do not type, I drag and drop the Netflix.apk from my destop onto the cmd window)

C. Add a space then add destination directory "C:/users/destop/Netflixmod"
Again, your address of wherever you are working, and whetever you want to call the destination folder. For this I also drag and drop the same file, and just remove the .apk text.

D. Hit enter
Code:
apktool d C:\users\desktop\Netflix1.4.apk "C:\users\desktop\Netflixmod"
Your desktop address will be different than what I have typed, your Netflix app or whatever app you are decompiling will be different and your destination address and directory name will be different. DO NOT COPY PASTE THIS CODE INTO YOUR CMD LINE.
Step 2. Edit the androidmanifest with Notepad++
__________________________________________________ _________
Quote:
This is for Netflix 1.4

In the folder that you just created on your desktop (or wherever you are working) There is a file called androidmanifest.xml
Open this file with Notepad++ and edit the following lines:

Change line 5: android:screenOrientation="portrait" to android:screenOrientation="sensor"
Change line 29: android:screenOrientation="landscape" to android:screenOrientation="sensor"

Save the file.
Step 3. Build the Application.apk with apktool
__________________________________________________ _________
Quote:
Similar to decompiling:
A.
Code:
apktool b C:\users\desktop\Netflixmod
This will build the application in the same folder that you are working in (i.e. "Netflixmod" folder) You can specify a new directory if you want, but I do not.
There will now be a folder named "Build" within the "Netflixmod" folder.
B. Copy the "Assets" folder into the "build" folder. (apktool leaves this out, but it is important).
C. Zip the contents of the build folder into a .zip file called apk.zip. (do not zip the Build folder, just everything inside of it INCLUDING THE ASSETS FOLDER!)
D. Rename the apk.zip file to apk.apk file.
Step 4. Sign the apk with autosign.
__________________________________________________ _________
Quote:

Well, sign the app with some signing tool that you are comfortable with.
Just google auto-sign apk, there are plenty of options. Cant find the link towhat I use. Please feel free to post an easy signing tool here if you want it added.
**************************************************
Attached Files
File Type: txt rotation mods1_4 - Copy.txt - [Click for QR Code] (7.3 KB, 108 views)
File Type: apk Netflix 1.4.0.apk - [Click for QR Code] (7.05 MB, 305 views)
My current device:
────────────────────
HTC HD2 (LEO) TmoUS 1024
OS: HyperDroid-CM7-v2.0.1
Kernal:Tytung_R9


My Work:
────────────────────
Netflix Rotation Enabled Apps: Netflix
Boot Animations: Link
Enable rotation in ANY app: Link
My Game: Floppy Fish


The Following 8 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
Dblfstr
Old
(Last edited by Dblfstr; 12th September 2011 at 08:25 PM.)
#2  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
Here is all of the code that I changed in the Netflix1.4 app to enable rotation and fix graphic bugs.

You can copy paste this into a text editor like Notepad++ and save as /.xml files. Then replace the files in your decompiled app with these. Or you can download the text file attached and create separate files out of each section of code.

New Netflix 1.4 Updated 9/09/2011

BELOW ARE THE FILES THAT NEED TO BE EDITED TO ENABLE ROTATION AND AVOID GRAPHICS BUGS.

TO CHANGE COLOR, EDIT THE "#ffb9090b" TO ANOTHER HEX COLOR. IN ALL FILES EXCEPT FOR THE ANDROID MANIFEST.


───────────────────────────────────
Android Manifest.xml:
───────────────────────────────────

Change line 5: android:screenOrientation="portrait" to android:screenOrientation="sensor"
Change line 29: android:screenOrientation="landscape" to android:screenOrientation="sensor"

Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="259" android:versionName="1.4.0 build 259" android:installLocation="auto" package="com.netflix.mediaclient"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <application android:theme="@android:style/Theme.NoTitleBar" android:label="@string/app_name" android:icon="@drawable/icon" android:name=".NetflixApplication" android:debuggable="false">
        <activity android:label="@string/app_name" android:name=".UIWebViewActivity" android:enabled="@bool/phone" android:finishOnTaskLaunch="false" android:clearTaskOnLaunch="true" android:launchMode="singleTop" android:screenOrientation="sensor" android:configChanges="keyboardHidden|orientation" android:alwaysRetainTaskState="true" android:allowTaskReparenting="true" android:windowSoftInputMode="stateVisible|adjustResize" android:noHistory="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="nflx" android:host="www.netflix.com" />
            </intent-filter>
        </activity>
        <activity android:label="@string/app_name" android:name=".UIWebViewTabletActivity" android:enabled="@bool/tablet" android:finishOnTaskLaunch="false" android:clearTaskOnLaunch="true" android:launchMode="singleTop" android:configChanges="keyboardHidden|orientation" android:alwaysRetainTaskState="true" android:allowTaskReparenting="true" android:windowSoftInputMode="stateVisible|adjustResize" android:noHistory="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="nflx" android:host="www.netflix.com" />
            </intent-filter>
        </activity>
        <activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:label="@string/app_name" android:name=".PlayerActivity" android:screenOrientation="sensor" android:configChanges="orientation" android:noHistory="false" />
    </application>
    <uses-feature android:name="android.hardware.telephony" android:required="false" />
    <uses-feature android:name="android.hardware.wifi" android:required="false" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.READ_LOGS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11" />
</manifest
\res\layout folder

playout_splash.xml
───────────────────────────────────
<!--
Edited Line 4: android:layout_gravity="bottom|center" to android:layout_gravity="center"
removed android:layout_marginBottom="150.0dip"
Edited Line 5: android:layout_marginBottom="100.0dip" to android:layout_marginBottom="90.0dip"
Dblfstr
-->

Code:
<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout android:orientation="vertical" android:id="@id/top_panel" android:background="#ffb9090b" android:visibility="visible" android:layout_width="fill_parent" android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <ImageView android:layout_gravity="center" android:id="@id/logo" android:visibility="visible" android:layout_width="202.0dip" android:layout_height="62.0dip" android:src="@drawable/logo_splash" />
    <ProgressBar android:layout_gravity="bottom|center" android:id="@id/pb_loading" android:visibility="visible" android:layout_width="30.0dip" android:layout_height="30.0dip" android:layout_marginBottom="90.0dip" android:indeterminate="true" android:indeterminateOnly="true" android:soundEffectsEnabled="false" style="?android:progressBarStyleSmallInverse" />
    <TextView android:textSize="14.0dip" android:textColor="#ffffffff" android:layout_gravity="bottom|center" android:id="@id/label_loading" android:visibility="visible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="50.0dip" android:text="@string/label_ps_loading" />
<!--
		Edited Line 4: 	android:layout_gravity="bottom|center" to android:layout_gravity="center"
						removed android:layout_marginBottom="150.0dip"
		Edited Line 5: 	android:layout_marginBottom="100.0dip" to android:layout_marginBottom="90.0dip"
		Dblfstr
	-->
</FrameLayout>
\res\layout folder

ui_splash.xml
───────────────────────────────────
<!--
Edited Line 4: android:layout_gravity="bottom|center" to android:layout_gravity="center"
removed android:layout_marginBottom="150.0dip"
Edited Line 5: android:layout_width="wrap_content" android:layout_height="wrap_content" to android:layout_width="30.0dip" android:layout_height="30.0dip" and "android:layout_marginTop="80.0dip"
Dblfstr
-->


Code:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout android:id="@id/FrameLayout" android:background="#ffb9090b" android:layout_width="fill_parent" android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <ImageView android:layout_gravity="center" android:id="@id/logo" android:visibility="visible" android:layout_width="202.0dip" android:layout_height="62.0dip" android:src="@drawable/logo_splash" android:layout_centerInParent="true" />
    <ProgressBar android:id="@id/ui_load" android:visibility="visible" android:layout_width="30.0dip" android:layout_height="30.0dip" android:layout_marginTop="80.0dip" android:indeterminate="true" android:indeterminateOnly="true" android:layout_below="@id/logo" android:layout_centerInParent="true" android:soundEffectsEnabled="false" />
	<!--
		Edited Line 4: 	android:layout_gravity="bottom|center" to android:layout_gravity="center"
						removed android:layout_marginBottom="150.0dip"
		Edited Line 5: 	android:layout_width="wrap_content" android:layout_height="wrap_content" to android:layout_width="30.0dip" android:layout_height="30.0dip" and "android:layout_marginTop="80.0dip"
		Dblfstr
	-->
</RelativeLayout>
\res\layout folder

webview.xml
───────────────────────────────────
<!--
Edited line 2; android:background hex values
-->

Code:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout android:orientation="vertical" android:id="@id/address" android:background="#ffb9090b" android:layout_width="fill_parent" android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout android:orientation="vertical" android:id="@id/go_button" android:layout_width="fill_parent" android:layout_height="fill_parent"
      xmlns:android="http://schemas.android.com/apk/res/android">
        <WebView android:id="@id/ui" android:background="@drawable/splash" android:visibility="visible" android:scrollbars="none" android:layout_width="fill_parent" android:layout_height="fill_parent" />
    </LinearLayout>
	<!--
	Edited line 2; 	android:background hex values
	-->
</LinearLayout>
all of this code is found in the attached .txt file. Remember to save each bit of code as a separate file and replace in your Netflix.apk.
My current device:
────────────────────
HTC HD2 (LEO) TmoUS 1024
OS: HyperDroid-CM7-v2.0.1
Kernal:Tytung_R9


My Work:
────────────────────
Netflix Rotation Enabled Apps: Netflix
Boot Animations: Link
Enable rotation in ANY app: Link
My Game: Floppy Fish


The Following 2 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
Dblfstr
Old
#3  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
and i need this
My current device:
────────────────────
HTC HD2 (LEO) TmoUS 1024
OS: HyperDroid-CM7-v2.0.1
Kernal:Tytung_R9


My Work:
────────────────────
Netflix Rotation Enabled Apps: Netflix
Boot Animations: Link
Enable rotation in ANY app: Link
My Game: Floppy Fish


 
Dblfstr
Old
#4  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
should take this
 
ncmacasl
Old
#5  
ncmacasl's Avatar
Senior Member
Thanks Meter 16
Posts: 148
Join Date: May 2011
Location: Wilson, NC

 
DONATE TO ME
for us NON programmers, anyway you (or someone else) can actually post a modified apk?
 
bklizard
Old
(Last edited by bklizard; 10th September 2011 at 09:55 PM.) Reason: updated progress
#6  
Junior Member
Thanks Meter 1
Posts: 4
Join Date: Sep 2011
Location: Richmond, VA
OK, so I tried to modify these .xml files... so far, I haven't been able to open them up successfully. So my noob-ish question is, "what editor do I use to open these up?" Standard XML editors found in Windows/Office doesn't show them right.

Or can I just replace the files altogether by copying and pasting the stuff in the post? ... I will try that first, I guess...

Update1:
So I extracted the files for editing, and then replaced all the lines in those files (which by the way, opened up to show some weird encoding) using Notepad++ ... I was able to replace all the stuff anyways, and I saved it. Re-packed the apk... Nothing changed. What am I missing??

Update 2:
I think my problem now is finding out how I can recompile the file and be able to either keep the signature or make a valid signature. I say this because now all I get when I try to install the modifed apk it says "error parsing file" or "... not signed correctly"

I give up! I tried and took a few shots at it, but I guess I am missing something. Oh well...
 
flappjaxxx
Old
(Last edited by flappjaxxx; 11th September 2011 at 05:12 AM.)
#7  
flappjaxxx's Avatar
Senior Member
Thanks Meter 11293
Posts: 2,588
Join Date: Apr 2009
Location: Somewhere, FL

 
DONATE TO ME
http://forum.xda-developers.com/show...3#post17446113

All Credit goes to Dblfstr!

Sent from A Van Down By The River!
The Following 2 Users Say Thank You to flappjaxxx For This Useful Post: [ Click to Expand ]
 
lennyjew
Old
#8  
lennyjew's Avatar
Member
Thanks Meter 4
Posts: 92
Join Date: Jul 2010
Location: Dublin
Worked like a charm dblfstr. Thanks.
The Following User Says Thank You to lennyjew For This Useful Post: [ Click to Expand ]
 
bklizard
Old
#9  
Junior Member
Thanks Meter 1
Posts: 4
Join Date: Sep 2011
Location: Richmond, VA
Whew, exactly what I needed. Thanks again. I guess I'LLC leave all the Modding stuff to the seasoned folks.
 
Dblfstr
Old
#10  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
Simple tutorial added.


Suggestions welcome

Thanks
My current device:
────────────────────
HTC HD2 (LEO) TmoUS 1024
OS: HyperDroid-CM7-v2.0.1
Kernal:Tytung_R9


My Work:
────────────────────
Netflix Rotation Enabled Apps: Netflix
Boot Animations: Link
Enable rotation in ANY app: Link
My Game: Floppy Fish



The Following User Says Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
Tags
manifest, mod, netflix, tut
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes