Skip to content

Commit 6504080

Browse files
committed
Add Project Code
1 parent 9bccf0c commit 6504080

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+798
-0
lines changed

SwipeView/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild

SwipeView/.idea/gradle.xml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SwipeView/.idea/misc.xml

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SwipeView/.idea/modules.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SwipeView/.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SwipeView/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

SwipeView/app/build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 25
5+
buildToolsVersion "26.0.0"
6+
defaultConfig {
7+
applicationId "com.learn2crack.swipeview"
8+
minSdkVersion 19
9+
targetSdkVersion 25
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
25+
exclude group: 'com.android.support', module: 'support-annotations'
26+
})
27+
implementation 'com.android.support:appcompat-v7:25.4.0'
28+
testImplementation 'junit:junit:4.12'
29+
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
30+
implementation 'com.android.support:design:25.4.0'
31+
}

SwipeView/app/proguard-rules.pro

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /home/rajamalw/android-sdk-linux/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
18+
19+
# Uncomment this to preserve the line number information for
20+
# debugging stack traces.
21+
#-keepattributes SourceFile,LineNumberTable
22+
23+
# If you keep the line number information, uncomment this to
24+
# hide the original source file name.
25+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.learn2crack.swipeview;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.learn2crack.swipeview", appContext.getPackageName());
25+
}
26+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.learn2crack.swipeview">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity
13+
android:name=".MainActivity"
14+
android:label="@string/app_name"
15+
android:theme="@style/AppTheme.NoActionBar">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
</application>
23+
24+
</manifest>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.learn2crack.swipeview;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.Nullable;
5+
import android.support.v4.app.Fragment;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
10+
public class HomeFragment extends Fragment {
11+
12+
public static final String TITLE = "Home";
13+
14+
public static HomeFragment newInstance() {
15+
16+
return new HomeFragment();
17+
}
18+
19+
@Nullable
20+
@Override
21+
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
22+
return inflater.inflate(R.layout.fragment_home, container, false);
23+
}
24+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.learn2crack.swipeview;
2+
3+
import android.os.Bundle;
4+
import android.support.design.widget.TabLayout;
5+
import android.support.v4.view.ViewPager;
6+
import android.support.v7.app.AppCompatActivity;
7+
import android.support.v7.widget.Toolbar;
8+
9+
public class MainActivity extends AppCompatActivity {
10+
11+
private ViewPager mViewPager;
12+
private Toolbar mToolbar;
13+
private ViewPagerAdapter mViewPagerAdapter;
14+
private TabLayout mTabLayout;
15+
16+
@Override
17+
protected void onCreate(Bundle savedInstanceState) {
18+
super.onCreate(savedInstanceState);
19+
setContentView(R.layout.activity_main);
20+
mToolbar = (Toolbar) findViewById(R.id.toolbar);
21+
setSupportActionBar(mToolbar);
22+
23+
setViewPager();
24+
25+
}
26+
27+
private void setViewPager() {
28+
29+
mViewPager = (ViewPager) findViewById(R.id.pager);
30+
mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
31+
mViewPager.setAdapter(mViewPagerAdapter);
32+
33+
mTabLayout = (TabLayout) findViewById(R.id.tab);
34+
mTabLayout.setupWithViewPager(mViewPager);
35+
}
36+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.learn2crack.swipeview;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.Nullable;
5+
import android.support.v4.app.Fragment;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
10+
public class ProfileFragment extends Fragment {
11+
12+
public static final String TITLE = "Profile";
13+
14+
public static ProfileFragment newInstance() {
15+
16+
return new ProfileFragment();
17+
}
18+
19+
@Nullable
20+
@Override
21+
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
22+
return inflater.inflate(R.layout.fragment_profile, container, false);
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.learn2crack.swipeview;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.Nullable;
5+
import android.support.v4.app.Fragment;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
10+
public class SettingsFragment extends Fragment {
11+
12+
public static final String TITLE = "Settings";
13+
14+
public static SettingsFragment newInstance() {
15+
16+
return new SettingsFragment();
17+
}
18+
19+
@Nullable
20+
@Override
21+
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
22+
return inflater.inflate(R.layout.fragment_settings, container, false);
23+
}
24+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.learn2crack.swipeview;
2+
3+
import android.support.v4.app.Fragment;
4+
import android.support.v4.app.FragmentManager;
5+
import android.support.v4.app.FragmentStatePagerAdapter;
6+
7+
public class ViewPagerAdapter extends FragmentStatePagerAdapter {
8+
9+
private static int TAB_COUNT = 3;
10+
11+
public ViewPagerAdapter(FragmentManager fm) {
12+
super(fm);
13+
}
14+
15+
@Override
16+
public Fragment getItem(int position) {
17+
18+
switch (position) {
19+
case 0:
20+
return HomeFragment.newInstance();
21+
case 1:
22+
return ProfileFragment.newInstance();
23+
case 2:
24+
return SettingsFragment.newInstance();
25+
}
26+
return null;
27+
}
28+
29+
@Override
30+
public int getCount() {
31+
return TAB_COUNT;
32+
}
33+
34+
@Override
35+
public CharSequence getPageTitle(int position) {
36+
switch (position) {
37+
case 0:
38+
return HomeFragment.TITLE;
39+
40+
case 1:
41+
return ProfileFragment.TITLE;
42+
43+
case 2:
44+
return SettingsFragment.TITLE;
45+
}
46+
return super.getPageTitle(position);
47+
}
48+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
tools:context="com.learn2crack.swipeview.MainActivity">
8+
9+
<android.support.design.widget.AppBarLayout
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content"
12+
android:theme="@style/AppTheme.AppBarOverlay">
13+
14+
<android.support.v7.widget.Toolbar
15+
android:id="@+id/toolbar"
16+
android:layout_width="match_parent"
17+
android:layout_height="?attr/actionBarSize"
18+
android:background="?attr/colorPrimary"
19+
app:popupTheme="@style/AppTheme.PopupOverlay" />
20+
<android.support.design.widget.TabLayout
21+
android:id="@+id/tab"
22+
android:layout_width="match_parent"
23+
android:layout_height="wrap_content" />
24+
25+
</android.support.design.widget.AppBarLayout>
26+
27+
<include layout="@layout/content_main" />
28+
29+
</android.support.design.widget.CoordinatorLayout>

0 commit comments

Comments
 (0)