Skip to content

Commit

Permalink
revamped tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
commonsguy committed Oct 9, 2016
1 parent c8771d5 commit 9f7222a
Show file tree
Hide file tree
Showing 669 changed files with 3,696 additions and 2,091 deletions.
34 changes: 23 additions & 11 deletions EmPubLite-AndroidStudio/T10-ViewPager/EmPubLite/app/build.gradle
@@ -1,15 +1,22 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.commonsware.empublite"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
minSdkVersion 15
targetSdkVersion 18
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.generatedDensities = ['hdpi','xxhdpi']
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

Expand All @@ -20,10 +27,15 @@ repositories {
}

dependencies {
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.commonsware.cwac:security:0.5.2'
compile 'com.android.support:support-v13:23.1.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.commonsware.cwac:security:0.8.0'
compile 'com.android.support:support-v13:24.2.1'
compile 'io.karim:materialtabs:2.0.5'
}

This file was deleted.

@@ -0,0 +1,28 @@
package com.commonsware.empublite;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing
* documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext=InstrumentationRegistry.getTargetContext();

assertEquals("com.commonsware.empublite",
appContext.getPackageName());
}
}
@@ -1,28 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.commonsware.empublite" >
<manifest package="com.commonsware.empublite"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />

<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".EmPubLiteActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".EmPubLiteActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SimpleContentActivity" />
</application>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SimpleContentActivity"></activity>
</application>

</manifest>
</manifest>
Expand Up @@ -6,45 +6,48 @@
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import io.karim.MaterialTabs;

public class EmPubLiteActivity extends Activity {
private ViewPager pager=null;
private ContentsAdapter adapter=null;
private ViewPager pager;
private ContentsAdapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
pager=(ViewPager)findViewById(R.id.pager);

pager=(ViewPager)findViewById(R.id.pager);
adapter=new ContentsAdapter(this);
pager.setAdapter(adapter);
findViewById(R.id.progressBar1).setVisibility(View.GONE);
pager.setVisibility(View.VISIBLE);

MaterialTabs tabs=(MaterialTabs)findViewById(R.id.tabs);
tabs.setViewPager(pager);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.options, menu);
return (super.onCreateOptionsMenu(menu));

return(super.onCreateOptionsMenu(menu));
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.about:
Intent i = new Intent(this, SimpleContentActivity.class);
Intent i=new Intent(this, SimpleContentActivity.class);
startActivity(i);

return (true);
return(true);

case R.id.help:
i = new Intent(this, SimpleContentActivity.class);
i=new Intent(this, SimpleContentActivity.class);
startActivity(i);

return (true);
return(true);
}
return (super.onOptionsItemSelected(item));

return(super.onOptionsItemSelected(item));
}
}
Expand Up @@ -4,6 +4,7 @@
import android.os.Bundle;

public class SimpleContentActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Expand Up @@ -8,16 +8,17 @@
import android.webkit.WebViewFragment;

public class SimpleContentFragment extends WebViewFragment {
private static final String KEY_FILE = "file";
private static final String KEY_FILE="file";

static SimpleContentFragment newInstance(String file) {
SimpleContentFragment f = new SimpleContentFragment();
Bundle args = new Bundle();
SimpleContentFragment f=new SimpleContentFragment();

Bundle args=new Bundle();

args.putString(KEY_FILE, file);
f.setArguments(args);

return (f);
return(f);
}

@Override
Expand All @@ -31,18 +32,18 @@ public void onCreate(Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View result =
super.onCreateView(inflater, container, savedInstanceState);
View result=
super.onCreateView(inflater, container, savedInstanceState);

getWebView().getSettings().setJavaScriptEnabled(true);
getWebView().getSettings().setSupportZoom(true);
getWebView().getSettings().setBuiltInZoomControls(true);
getWebView().loadUrl(getPage());

return (result);
return(result);
}

private String getPage() {
return (getArguments().getString(KEY_FILE));
return(getArguments().getString(KEY_FILE));
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M11,18h2v-2h-2v2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM12,6c-2.21,0 -4,1.79 -4,4h2c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,2 -3,1.75 -3,5h2c0,-2.25 3,-2.5 3,-5 0,-2.21 -1.79,-4 -4,-4z"
android:fillColor="#000000"/>
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textMultiLine"
android:ems="10"
android:id="@+id/editor"
android:hint="@string/hint"
android:gravity="top|start" />
</LinearLayout>
@@ -1,20 +1,20 @@
<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"
tools:context=".EmPubLiteActivity">
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar1"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<io.karim.MaterialTabs
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dp"
app:mtIndicatorColor="@color/colorAccent"
app:mtSameWeightTabs="true"/>

<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
</RelativeLayout>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
</LinearLayout>
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/help"
android:icon="@drawable/ic_action_help"
android:title="@string/help">
</item>
<item
android:id="@+id/about"
android:icon="@drawable/ic_action_about"
android:title="@string/about">
</item>
<item
android:id="@+id/help"
android:icon="@drawable/ic_help_outline_black_24px"
android:title="@string/help">
</item>
<item
android:id="@+id/about"
android:icon="@drawable/ic_info_outline_black_24dp"
android:title="@string/about">
</item>

</menu>
@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">EmPub Lite</string>
<string name="hint">Enter notes here</string>
<string name="help">Help</string>
<string name="about">About</string>

</resources>

0 comments on commit 9f7222a

Please sign in to comment.