Skip to content

Commit

Permalink
Improve library layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Blanka Kulik committed Sep 11, 2017
1 parent f3acc1d commit a0087bc
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 78 deletions.
13 changes: 8 additions & 5 deletions androidtweakslibrary/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

package="no.agens.androidtweakslibrary">

<application android:allowBackup="true" android:label="@string/app_name"
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">
<activity
android:name=".activities.TweakStoreActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:screenOrientation="portrait"/>
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light"/>

<activity
android:name=".activities.CollectionActvity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:screenOrientation="portrait"
android:parentActivityName=".activities.TweakStoreActivity"/>
android:parentActivityName=".activities.TweakStoreActivity"
android:theme="@style/Theme.AppCompat.Light"/>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import no.agens.androidtweakslibrary.R;
import no.agens.androidtweakslibrary.adapter.TweaksAdapter;
import no.agens.androidtweakslibrary.models.Collection;
import no.agens.androidtweakslibrary.models.TweakStore;
import no.agens.androidtweakslibrary.R;

public class CollectionActvity extends AppCompatActivity {
private static String TWEAK_STORE_NAME = "tweakStoreName";
Expand All @@ -59,8 +58,7 @@ protected void onCreate(Bundle savedInstanceState) {
TweakStore tweakStore = TweakStore.getInstance(this, tweakStoreName);
Collection collection = tweakStore.getCollections().get(collectionId);

TextView collectionNameTV = (TextView) findViewById(R.id.collection_name_textView);
collectionNameTV.setText(collection.getName());
setTitle(collection.getName());

RecyclerView recyclerView = (RecyclerView) findViewById(R.id.group_recyclerView);
recyclerView.setHasFixedSize(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -60,8 +59,7 @@ protected void onCreate(Bundle savedInstanceState) {
tweakStoreName = getIntent().getExtras().getString(TWEAK_STORE_NAME);
}

TextView tweakStoreNameTV = (TextView) findViewById(R.id.tweaksStore_name_textView);
tweakStoreNameTV.setText(tweakStoreName);
setTitle(tweakStoreName);

TweakStore tweakStore = TweakStore.getInstance(this, tweakStoreName);
collections = tweakStore.getCollections();
Expand All @@ -70,7 +68,7 @@ protected void onCreate(Bundle savedInstanceState) {
for (int i = 0; i < collections.size(); i++) {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("name", collections.get(i).getName());
hashMap.put("number", collections.get(i).getCountOfTweaks() + " >");
hashMap.put("number", collections.get(i).getCountOfTweaks().toString());
arrayList.add(hashMap);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -84,7 +85,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
TextView tweakNameTextView = (TextView) view.findViewById(R.id.tweak_name_textView);
tweakNameTextView.setText(tweakName);

Switch switchButton = (Switch) view.findViewById(R.id.switch_button);
SwitchCompat switchButton = (SwitchCompat) view.findViewById(R.id.switch_button);

Boolean tweakBooleanValue = tweakStore.getValue((TweakBoolean) tweak);
switchButton.setChecked(tweakBooleanValue);
Expand Down
19 changes: 1 addition & 18 deletions androidtweakslibrary/src/main/res/layout/activity_groups.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/lightGrey">

<TextView
android:id="@+id/collection_name_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:gravity="center"
android:background="@color/lightestGrey"
android:textSize="16sp"
android:textColor="@android:color/black"
android:textStyle="bold"/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/boarderGrey"/>
android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
android:id="@+id/group_recyclerView"
Expand Down
15 changes: 0 additions & 15 deletions androidtweakslibrary/src/main/res/layout/activity_tweak_store.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/tweaksStore_name_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="16dp"
android:textSize="16sp"
android:textColor="@android:color/black"
android:textStyle="bold"/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGrey"/>

<ListView
android:id="@+id/tweak_store_ListView"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/lightGrey"
android:id="@+id/recyclerView_layout">

<TextView
android:id="@+id/group_name_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="56dp"
android:minHeight="60dp"
android:gravity="center_vertical"
android:padding="10dp"
android:textSize="16sp"/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/boarderGrey"/>
android:padding="16dp"
android:textSize="14sp"/>

<LinearLayout
android:id="@+id/tweaks_linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginBottom="30dp"/>
android:orientation="vertical"/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/boarderGrey"
android:layout_marginLeft="16dp"
android:layout_marginBottom="16dp"/>

</LinearLayout>
14 changes: 5 additions & 9 deletions androidtweakslibrary/src/main/res/layout/tweak_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
android:layout_height="match_parent">

<LinearLayout
android:orientation="horizontal"
Expand All @@ -26,18 +25,15 @@
android:textSize="16sp"
android:textColor="@android:color/black"/>

<Switch
<android.support.v7.widget.SwitchCompat
android:id="@+id/switch_button"
android:layout_width="50dp"
android:layout_height="30dp"
android:paddingLeft="8dp"
android:checked="false"
android:text=""/>
android:text=""
android:theme="@style/Switch"/>

</LinearLayout>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/boarderGrey"/>

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="56dp"
android:minHeight="60dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingRight="24dp"
android:gravity="center_vertical">

<TextView
android:id="@+id/collection_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="9"
android:padding="8dp"
android:layout_weight="1"
android:textSize="16sp"
android:textColor="@android:color/black"/>

<TextView
android:id="@+id/collection_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="8dp"
android:text="4 >"/>
android:text="4"/>

</LinearLayout>
5 changes: 3 additions & 2 deletions androidtweakslibrary/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="lightGrey">#EEEEEE</color>
<color name="lightestGrey">#F5F5F5</color>
<color name="boarderGrey">#BDBDBD</color>
<color name="switchBlue">#2962FF</color>
<color name="colorPrimary">@android:color/white</color>
<color name="colorPrimaryDark">#757575</color>
<color name="colorAccent">#3F51B5</color>
</resources>
20 changes: 20 additions & 0 deletions androidtweakslibrary/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<resources>

<!-- Base application theme. -->
<style name="AndroidTweaksTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="Switch" parent="AndroidTweaksTheme">
<!-- active thumb & track color (30% transparency) -->
<item name="colorControlActivated">#3F51B5</item>

<!-- inactive thumb color -->
<item name="colorSwitchThumbNormal">#757575</item>

<!-- inactive track color (30% transparency) -->
<item name="android:colorForeground">#757575</item>
</style>
</resources>
7 changes: 4 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="no.agens.androidtweaks">

<application
Expand All @@ -8,9 +9,9 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
tools:replace="android:theme"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/no/agens/androidtweaks/MyTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,19 @@
public class MyTweaks {
public static final TweakBoolean darkTheme = new TweakBoolean("Styling", "Theme", "Dark", false);
public static final TweakBoolean bigFonts = new TweakBoolean("Styling", "Fonts", "Big", true);
public static final TweakBoolean smallFonts = new TweakBoolean("Styling", "Fonts", "Small", false);
public static final TweakBoolean newOne = new TweakBoolean("Paramppppppppppppppp", "Pampam", "Piggy", false);
public static final TweakBoolean newTwo = new TweakBoolean("Paramppp", "Pampam", "Piggy", false);
public static final TweakBoolean newThree = new TweakBoolean("P", "Pampam", "Piggy", false);
public static final TweakBoolean newFour = new TweakBoolean("Parampppppppppppppppjjujjuhcxxgxxgxxgxgxxxx", "Pampam", "Piggy", true);

public static final List<Tweak> tweaks = new ArrayList<Tweak>() {{
add(darkTheme);
add(bigFonts);
add(smallFonts);
add(newOne);
add(newTwo);
add(newThree);
add(newFour);
}};
}

0 comments on commit a0087bc

Please sign in to comment.