Skip to content

Commit

Permalink
Removing the theme code from previous commit. Needs to be done proper…
Browse files Browse the repository at this point in the history
…ly with android themes/styles
  • Loading branch information
markwinter committed Apr 13, 2014
1 parent 59f4e30 commit 4f52f01
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
19 changes: 4 additions & 15 deletions app/src/main/java/im/tox/antox/activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.Toast;
Expand Down Expand Up @@ -207,6 +208,7 @@ protected void onNewIntent(Intent i) {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

/* Fix for an android 4.1.x bug */
if(Build.VERSION.SDK_INT != Build.VERSION_CODES.JELLY_BEAN
Expand All @@ -221,6 +223,8 @@ protected void onCreate(Bundle savedInstanceState) {
SharedPreferences pref = getSharedPreferences("main",
Context.MODE_PRIVATE);

SharedPreferences settings = getSharedPreferences("settings", Context.MODE_PRIVATE);

// If beenLoaded is 0, then never been run
if (pref.getInt("beenLoaded", 0) == 0) {
// Launch welcome activity which will run the user through initial
Expand Down Expand Up @@ -287,23 +291,8 @@ protected void onCreate(Bundle savedInstanceState) {

toxSingleton.activeFriendKey=null;
toxSingleton.activeFriendRequestKey=null;
setContentView(R.layout.activity_main);
toxSingleton.leftPaneActive = true;

// Check for a theme - currently this isn't very expandable to allow for user created themes
// but works for just setting a dark theme
if(settingsPref.getString("theme", "").equals("Dark")) {
// CHAT FRAGMENT - BACKGROUND COLOR
FrameLayout chatLayout = (FrameLayout) findViewById(R.id.right_pane);
chatLayout.setBackgroundColor(Color.rgb(64,64,64)); // zoo lane

// ACTION BAR - BACKGROUND COLOR
ActionBar bar = getSupportActionBar();
bar.setBackgroundDrawable(new ColorDrawable(Color.rgb(13,13,13)));


}

/* Check if connected to the Internet */
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down
26 changes: 26 additions & 0 deletions app/src/main/res/layout/activity_main_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/slidingpane_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Left side pane. (Master) -->
<fragment android:id="@+id/fragment_contacts"
android:name="im.tox.antox.fragments.ContactsFragment"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_marginRight="30dp"
android:layout_gravity="left"
tools:layout="@layout/fragment_leftpane" />

<FrameLayout
android:background="#262626"
android:id="@+id/right_pane"
android:layout_width="350dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_weight="1"
/>

</android.support.v4.widget.SlidingPaneLayout>
1 change: 1 addition & 0 deletions app/src/main/res/layout/fragment_leftpane.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
Expand Down

0 comments on commit 4f52f01

Please sign in to comment.