Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit 3359e28

Browse files
author
Evgeniy Kanivets
committed
Removed title bar, add styles for different android versions
1 parent 0a1d757 commit 3359e28

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
android:allowBackup="true"
88
android:icon="@drawable/ic_launcher"
99
android:label="@string/app_name"
10-
android:theme="@style/AppTheme" >
10+
android:theme="@style/Theme.NoTitle" >
1111
<activity
1212
android:name=".activity.MainActivity"
1313
android:label="@string/app_name" >
1414
<intent-filter>
1515
<action android:name="android.intent.action.MAIN" />
16-
1716
<category android:name="android.intent.category.LAUNCHER" />
1817
</intent-filter>
1918
</activity>

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/MainActivity.java

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.Activity;
44
import android.content.DialogInterface;
5+
import android.content.pm.FeatureInfo;
56
import android.database.Cursor;
67
import android.database.sqlite.SQLiteDatabase;
78
import android.support.v7.app.ActionBarActivity;
@@ -10,6 +11,7 @@
1011
import android.view.Menu;
1112
import android.view.MenuItem;
1213
import android.view.View;
14+
import android.view.Window;
1315
import android.widget.BaseAdapter;
1416
import android.widget.Button;
1517
import android.widget.ListView;
@@ -30,7 +32,7 @@
3032
import java.util.Observer;
3133

3234

33-
public class MainActivity extends ActionBarActivity implements Observer{
35+
public class MainActivity extends Activity implements Observer{
3436

3537
private Activity activity;
3638

@@ -42,6 +44,9 @@ public class MainActivity extends ActionBarActivity implements Observer{
4244
@Override
4345
protected void onCreate(Bundle savedInstanceState) {
4446
super.onCreate(savedInstanceState);
47+
48+
requestWindowFeature(Window.FEATURE_NO_TITLE);
49+
4550
setContentView(R.layout.activity_main);
4651

4752
activity = this;
@@ -76,26 +81,6 @@ public void onClick(View v) {
7681
MTHelper.getInstance().addObserver(this);
7782
}
7883

79-
80-
@Override
81-
public boolean onCreateOptionsMenu(Menu menu) {
82-
// Inflate the menu; this adds items to the action bar if it is present.
83-
getMenuInflater().inflate(R.menu.main, menu);
84-
return true;
85-
}
86-
87-
@Override
88-
public boolean onOptionsItemSelected(MenuItem item) {
89-
// Handle action bar item clicks here. The action bar will
90-
// automatically handle clicks on the Home/Up button, so long
91-
// as you specify a parent activity in AndroidManifest.xml.
92-
int id = item.getItemId();
93-
if (id == R.id.action_settings) {
94-
return true;
95-
}
96-
return super.onOptionsItemSelected(item);
97-
}
98-
9984
@Override
10085
public void update(Observable observable, Object data) {
10186
((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources xmlns:android="http://schemas.android.com/apk/res/android">
3+
<style name="Theme.Default" parent="@android:style/Theme.Holo"></style>
4+
<style name="Theme.NoTitle" parent="@android:style/Theme.Holo.NoActionBar"></style>
5+
<style name="Theme.FullScreen" parent="@android:style/Theme.Holo.NoActionBar.Fullscreen"></style>
6+
</resources>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources xmlns:android="http://schemas.android.com/apk/res/android">
3+
<style name="Theme.Default" parent="@android:style/Theme.Holo.Light"></style>
4+
<style name="Theme.NoTitle" parent="@android:style/Theme.Holo.Light.NoActionBar"></style>
5+
<style name="Theme.FullScreen" parent="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"></style>
6+
</resources>

app/src/main/res/values/styles.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
<resources>
2-
3-
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5-
<!-- Customize your theme here. -->
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources xmlns:android="http://schemas.android.com/apk/res/android">
3+
<style name="Theme.Default" parent="@android:style/Theme">
4+
<item name="android:background">#ffffffff</item>
5+
</style>
6+
<style name="Theme.NoTitle" parent="@android:style/Theme.NoTitleBar">
7+
<item name="android:background">#ffffffff</item>
8+
</style>
9+
<style name="Theme.FullScreen" parent="@android:style/Theme.NoTitleBar.Fullscreen">
10+
<item name="android:background">#ffffffff</item>
611
</style>
7-
812
</resources>

0 commit comments

Comments
 (0)