Skip to content

Commit 22a4afc

Browse files
committed
Basic application structure template
1 parent 7f3c406 commit 22a4afc

Some content is hidden

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

63 files changed

+1673
-0
lines changed

.gitignore

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

.idea/compiler.xml

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

.idea/copyright/profiles_settings.xml

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

.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.

.idea/misc.xml

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

.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.

.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.

app/.gitignore

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

app/build.gradle

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

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in C:\Users\Henry\AppData\Local\Android\sdk/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+
#}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.inducesmile.apkanalyzer;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="sk.styk.martin.apkanalyzer">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:supportsRtl="true"
10+
android:theme="@style/AppTheme">
11+
<activity
12+
android:name=".MainActivity"
13+
android:label="@string/app_name"
14+
android:theme="@style/AppTheme.NoActionBar">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
18+
<category android:name="android.intent.category.LAUNCHER" />
19+
</intent-filter>
20+
</activity>
21+
<activity
22+
android:name=".ItemListActivity"
23+
android:label="@string/title_item_list"
24+
android:theme="@style/AppTheme.NoActionBar"></activity>
25+
<activity
26+
android:name=".ItemDetailActivity"
27+
android:label="@string/title_item_detail"
28+
android:parentActivityName=".ItemListActivity"
29+
android:theme="@style/AppTheme.NoActionBar">
30+
<meta-data
31+
android:name="android.support.PARENT_ACTIVITY"
32+
android:value="sk.styk.martin.apkanalyzer.ItemListActivity" />
33+
</activity>
34+
</application>
35+
36+
</manifest>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package sk.styk.martin.apkanalyzer;
2+
3+
import android.os.Bundle;
4+
import android.support.v4.app.Fragment;
5+
import android.view.LayoutInflater;
6+
import android.view.View;
7+
import android.view.ViewGroup;
8+
9+
10+
/**
11+
* A simple {@link Fragment} subclass.
12+
*/
13+
public class DefaultFragment extends Fragment {
14+
15+
16+
public DefaultFragment() {
17+
// Required empty public constructor
18+
}
19+
20+
@Override
21+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
22+
// Inflate the layout for this fragment
23+
return inflater.inflate(sk.styk.martin.apkanalyzer.R.layout.fragment_default, container, false);
24+
}
25+
26+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package sk.styk.martin.apkanalyzer;
2+
3+
import android.content.Intent;
4+
import android.os.Bundle;
5+
import android.support.v4.app.NavUtils;
6+
import android.support.v7.app.ActionBar;
7+
import android.support.v7.app.AppCompatActivity;
8+
import android.support.v7.widget.Toolbar;
9+
import android.view.MenuItem;
10+
11+
/**
12+
* An activity representing a single Item detail screen. This
13+
* activity is only used narrow width devices. On tablet-size devices,
14+
* item details are presented side-by-side with a list of items
15+
* in a {@link ItemListActivity}.
16+
*/
17+
public class ItemDetailActivity extends AppCompatActivity {
18+
19+
@Override
20+
protected void onCreate(Bundle savedInstanceState) {
21+
super.onCreate(savedInstanceState);
22+
setContentView(sk.styk.martin.apkanalyzer.R.layout.activity_item_detail);
23+
Toolbar toolbar = (Toolbar) findViewById(sk.styk.martin.apkanalyzer.R.id.detail_toolbar);
24+
setSupportActionBar(toolbar);
25+
26+
// Show the Up button in the action bar.
27+
ActionBar actionBar = getSupportActionBar();
28+
if (actionBar != null) {
29+
actionBar.setDisplayHomeAsUpEnabled(true);
30+
}
31+
32+
// savedInstanceState is non-null when there is fragment state
33+
// saved from previous configurations of this activity
34+
// (e.g. when rotating the screen from portrait to landscape).
35+
// In this case, the fragment will automatically be re-added
36+
// to its container so we don't need to manually add it.
37+
// For more information, see the Fragments API guide at:
38+
//
39+
// http://developer.android.com/guide/components/fragments.html
40+
//
41+
if (savedInstanceState == null) {
42+
// Create the detail fragment and add it to the activity
43+
// using a fragment transaction.
44+
Bundle arguments = new Bundle();
45+
arguments.putString(ItemDetailFragment.ARG_ITEM_ID,
46+
getIntent().getStringExtra(ItemDetailFragment.ARG_ITEM_ID));
47+
ItemDetailFragment fragment = new ItemDetailFragment();
48+
fragment.setArguments(arguments);
49+
getSupportFragmentManager().beginTransaction()
50+
.add(sk.styk.martin.apkanalyzer.R.id.item_detail_container, fragment)
51+
.commit();
52+
}
53+
}
54+
55+
@Override
56+
public boolean onOptionsItemSelected(MenuItem item) {
57+
int id = item.getItemId();
58+
if (id == android.R.id.home) {
59+
// This ID represents the Home or Up button. In the case of this
60+
// activity, the Up button is shown. Use NavUtils to allow users
61+
// to navigate up one level in the application structure. For
62+
// more details, see the Navigation pattern on Android Design:
63+
//
64+
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
65+
//
66+
NavUtils.navigateUpTo(this, new Intent(this, ItemListActivity.class));
67+
return true;
68+
}
69+
return super.onOptionsItemSelected(item);
70+
}
71+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package sk.styk.martin.apkanalyzer;
2+
3+
import android.app.Activity;
4+
import android.support.design.widget.CollapsingToolbarLayout;
5+
import android.os.Bundle;
6+
import android.support.v4.app.Fragment;
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
import android.widget.TextView;
11+
12+
import sk.styk.martin.apkanalyzer.dummy.DummyContent;
13+
14+
/**
15+
* A fragment representing a single Item detail screen.
16+
* This fragment is either contained in a {@link ItemListActivity}
17+
* in two-pane mode (on tablets) or a {@link ItemDetailActivity}
18+
* on handsets.
19+
*/
20+
public class ItemDetailFragment extends Fragment {
21+
/**
22+
* The fragment argument representing the item ID that this fragment
23+
* represents.
24+
*/
25+
public static final String ARG_ITEM_ID = "item_id";
26+
27+
/**
28+
* The dummy content this fragment is presenting.
29+
*/
30+
private DummyContent.DummyItem mItem;
31+
32+
/**
33+
* Mandatory empty constructor for the fragment manager to instantiate the
34+
* fragment (e.g. upon screen orientation changes).
35+
*/
36+
public ItemDetailFragment() {
37+
}
38+
39+
@Override
40+
public void onCreate(Bundle savedInstanceState) {
41+
super.onCreate(savedInstanceState);
42+
43+
if (getArguments().containsKey(ARG_ITEM_ID)) {
44+
// Load the dummy content specified by the fragment
45+
// arguments. In a real-world scenario, use a Loader
46+
// to load content from a content provider.
47+
mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
48+
49+
Activity activity = this.getActivity();
50+
CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(sk.styk.martin.apkanalyzer.R.id.toolbar_layout);
51+
if (appBarLayout != null) {
52+
appBarLayout.setTitle(mItem.content);
53+
}
54+
}
55+
}
56+
57+
@Override
58+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
59+
View rootView = inflater.inflate(sk.styk.martin.apkanalyzer.R.layout.item_detail, container, false);
60+
61+
// Show the dummy content as text in a TextView.
62+
if (mItem != null) {
63+
((TextView) rootView.findViewById(sk.styk.martin.apkanalyzer.R.id.item_detail)).setText(mItem.details);
64+
}
65+
66+
return rootView;
67+
}
68+
}

0 commit comments

Comments
 (0)