[and] Intermediate commit of EFS.

This commit is contained in:
d-kunin 2013-08-12 11:35:24 +03:00
parent d51ceb7725
commit 343f7f2442
8 changed files with 148 additions and 5 deletions

View file

@ -10,6 +10,24 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Required to access Google Play Licensing -->
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<!-- Required to download files from Google Play -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required to keep CPU alive while downloading files (NOT to keep screen awake) -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Required to poll the state of the network connection and respond to changes -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Required to check whether Wi-Fi is enabled -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- Required to read and write the expansion files on shared storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
@ -21,11 +39,6 @@
android:label="@string/app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.travelguide.ArticleInfoDetailActivity"
@ -36,6 +49,17 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".ArticleInfoListActivity" />
</activity>
<activity
android:name="com.example.travelguide.ExpansionActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -1,6 +1,8 @@
APP_STL := gnustl_static
APP_PLATFORM := android-9
APP_ABI := all
# remove in release
APP_OPTIM := debug
LOCAL_PATH := $(call my-dir)
APP_CFLAGS += -I$(LOCAL_PATH)/../../3rdparty/boost

View file

@ -0,0 +1,11 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".ExpansionActivity" >
</RelativeLayout>

View file

@ -0,0 +1,9 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>
</resources>

View file

@ -8,5 +8,7 @@
<dimen name="pad_mid">8dp</dimen>
<dimen name="pad_small">4dp</dimen>
<dimen name="thumb_sep">3dp</dimen>
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View file

@ -0,0 +1,26 @@
package com.example.travelguide;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class ExpansionActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
forwardToApp();
// setContentView(R.layout.activity_expansion);
}
private void forwardToApp()
{
finish();
final Intent i = new Intent(this, ArticleInfoListActivity.class);
startActivity(i);
}
}

View file

@ -0,0 +1,29 @@
package com.example.travelguide.expansion;
import com.google.android.vending.expansion.downloader.impl.DownloaderService;
public class ExpansionService extends DownloaderService
{
@Override
public String getPublicKey()
{
// TODO Auto-generated method stub
return null;
}
@Override
public byte[] getSALT()
{
// TODO Auto-generated method stub
return null;
}
@Override
public String getAlarmReceiverClassName()
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -0,0 +1,40 @@
package com.example.travelguide.util;
import java.io.File;
import android.os.Environment;
public class Expansion
{
public static String getMainObbFileName(String version, String packageName)
{
final String path = String.format("main.%s.%s.obb", version, packageName);
return path;
}
public static String getObbLocation(String packageName)
{
final String location = Environment.getExternalStorageDirectory() + File.separator
+ "Android" + File.separator
+ "obb" + File.separator
+ packageName;
return location;
}
public static String getMainObbPath(String version, String packageName)
{
final String mainObbPath = getObbLocation(packageName) + File.separator
+ getMainObbFileName(version, packageName);
return mainObbPath;
}
public static boolean isObbFilePresent(String version, String packageName)
{
final String obbPath = getMainObbPath(version, packageName);
final boolean exists = Utils.fileExists(obbPath);
return exists;
}
private Expansion() {}
}