Skip to content

Commit

Permalink
Close #27 - Compatibility with Android 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vladholubiev committed Feb 11, 2015
1 parent 4a02dbf commit 128e1e9
Show file tree
Hide file tree
Showing 13 changed files with 258 additions and 16 deletions.
Binary file modified app/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ android {
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "ua.samosfator.moduleok"
minSdkVersion 14
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionCode 2
versionName "0.5.0"
signingConfig signingConfigs.config
}
Expand Down
27 changes: 19 additions & 8 deletions app/manifest-merger-release-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ MERGED from com.android.support:appcompat-v7:21.0.3:16:5
MERGED from com.android.support:support-v4:21.0.3:16:5
MERGED from com.android.support:recyclerview-v7:21.0.3:17:5
MERGED from com.android.support:support-v4:21.0.3:16:5
MERGED from com.google.android.gms:play-services-base:6.5.87:20:5
MERGED from com.android.support:support-v4:21.0.3:16:5
MERGED from com.android.support:appcompat-v7:21.0.3:16:5
MERGED from com.android.support:support-v4:21.0.3:16:5
MERGED from com.balysv:material-ripple:1.0.0:12:5
Expand Down Expand Up @@ -63,28 +65,37 @@ action#android.net.conn.CONNECTIVITY_CHANGE
ADDED from AndroidManifest.xml:21:17
android:name
ADDED from AndroidManifest.xml:21:25
activity#ua.samosfator.moduleok.MainActivity
meta-data#com.google.android.gms.version
ADDED from AndroidManifest.xml:25:9
MERGED from com.google.android.gms:play-services-base:6.5.87:21:9
android:value
ADDED from AndroidManifest.xml:26:20
android:name
ADDED from AndroidManifest.xml:25:20
activity#ua.samosfator.moduleok.MainActivity
ADDED from AndroidManifest.xml:28:9
android:label
ADDED from AndroidManifest.xml:27:13
ADDED from AndroidManifest.xml:30:13
android:name
ADDED from AndroidManifest.xml:26:13
ADDED from AndroidManifest.xml:29:13
intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER
ADDED from AndroidManifest.xml:28:13
ADDED from AndroidManifest.xml:31:13
action#android.intent.action.MAIN
ADDED from AndroidManifest.xml:29:17
ADDED from AndroidManifest.xml:32:17
android:name
ADDED from AndroidManifest.xml:29:25
ADDED from AndroidManifest.xml:32:25
category#android.intent.category.LAUNCHER
ADDED from AndroidManifest.xml:31:17
ADDED from AndroidManifest.xml:34:17
android:name
ADDED from AndroidManifest.xml:31:27
ADDED from AndroidManifest.xml:34:27
uses-sdk
INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested
MERGED from com.android.support:appcompat-v7:21.0.3:15:5
MERGED from com.android.support:support-v4:21.0.3:15:5
MERGED from com.android.support:recyclerview-v7:21.0.3:15:5
MERGED from com.android.support:support-v4:21.0.3:15:5
MERGED from com.google.android.gms:play-services-base:6.5.87:18:5
MERGED from com.android.support:support-v4:21.0.3:15:5
MERGED from com.rengwuxian.materialedittext:library:1.7.1:6:5
MERGED from com.android.support:appcompat-v7:21.0.3:15:5
MERGED from com.android.support:support-v4:21.0.3:15:5
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?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="ua.samosfator.moduleok">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<uses-sdk tools:overrideLibrary="com.balysv.materialripple, com.dd.circular.progress.button"/>

<application
android:allowBackup="true"
android:largeHeap="false"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/ua/samosfator/moduleok/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.graphics.Point;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.view.Display;
import android.view.WindowManager;

Expand Down Expand Up @@ -89,4 +90,8 @@ public static boolean isServiceRunning(Class<? extends Service> serviceClass) {
}
return false;
}

public static boolean is_4_0_OrLater() {

This comment has been minimized.

Copy link
@hermanstankov

hermanstankov Feb 11, 2015

lolled of that naming

return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;

import com.dd.CircularProgressButton;
import com.rengwuxian.materialedittext.MaterialEditText;
Expand All @@ -24,7 +25,7 @@
import ua.samosfator.moduleok.event.LoginEvent;

public class LoginFragment extends Fragment {
private CircularProgressButton login_button;
private Button login_button;
private MaterialEditText login_txt;
private MaterialEditText password_txt;

Expand Down Expand Up @@ -109,7 +110,11 @@ private void doLogin(final String login, final String password) {
private void initViews() {
login_txt = (MaterialEditText) rootView.findViewById(R.id.login_editText);
password_txt = (MaterialEditText) rootView.findViewById(R.id.password_editText);
login_button = (CircularProgressButton) rootView.findViewById(R.id.btnWithText);
if (App.is_4_0_OrLater()) {
login_button = (CircularProgressButton) rootView.findViewById(R.id.btnWithText);
} else {
login_button = (Button) rootView.findViewById(R.id.btnWithText);
}
}

public LoginFragment restoreView() {
Expand All @@ -135,8 +140,12 @@ private void enableInputs(final boolean bool) {
new Handler(Looper.getMainLooper()).post(() -> {
login_txt.setEnabled(bool);
password_txt.setEnabled(bool);
login_button.setIndeterminateProgressMode(!bool);
login_button.setProgress(bool ? 0 : 50);
if (App.is_4_0_OrLater()) {
((CircularProgressButton) login_button).setIndeterminateProgressMode(!bool);
((CircularProgressButton) login_button).setProgress(bool ? 0 : 50);
} else {
login_button.setEnabled(bool);
}
});
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package ua.samosfator.moduleok.fragment.navigation_drawer_fragment;

import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.support.v4.app.FragmentActivity;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.view.View;

import ua.samosfator.moduleok.App;
import ua.samosfator.moduleok.Preferences;

public class NavigationDrawerToggle extends ActionBarDrawerToggle {
Expand All @@ -22,19 +25,25 @@ public NavigationDrawerToggle(Activity activity, DrawerLayout drawerLayout, Tool
drawerLayout.post(this::syncState);
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
if (!mUserSawDrawer) {
saveUserSawDrawerState();
}
activity.invalidateOptionsMenu();
if (App.is_4_0_OrLater()) {
activity.invalidateOptionsMenu();
}
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
activity.invalidateOptionsMenu();
if (App.is_4_0_OrLater()) {
activity.invalidateOptionsMenu();
}
}

private void saveUserSawDrawerState() {
Expand Down
74 changes: 74 additions & 0 deletions app/src/main/res/layout-v10/fragment_login.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="32dp"
tools:context="ua.samosfator.moduleok.fragment.LoginFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/login_explanation"
android:id="@+id/textView"
android:padding="16dp"
android:gravity="center"
android:layout_marginBottom="24dp"
android:textColor="@color/textColorPrimary"
android:textSize="26sp"
android:background="@color/colorPrimary"
android:layout_above="@+id/login_editText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>

<com.rengwuxian.materialedittext.MaterialEditText
app:baseColor="@color/grey_900"
app:primaryColor="@color/colorPrimary"
app:floatingLabel="normal"
app:minCharacters="4"
app:maxCharacters="16"
android:id="@+id/login_editText"
android:layout_width="@dimen/login_fields_with"
android:layout_height="wrap_content"
android:text=""
android:textSize="16sp"
android:hint="@string/login_editText_hint"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:inputType="textNoSuggestions"/>

<com.rengwuxian.materialedittext.MaterialEditText
app:baseColor="@color/grey_900"
app:primaryColor="@color/colorPrimary"
app:floatingLabel="normal"
app:minCharacters="4"
app:maxCharacters="16"
android:id="@+id/password_editText"
android:layout_width="@dimen/login_fields_with"
android:layout_height="wrap_content"
android:text=""
android:textSize="16sp"
android:layout_below="@+id/login_editText"
android:layout_centerHorizontal="true"
android:hint="@string/password_editText_hint"
android:layout_marginTop="8dp"
android:inputType="textPassword"/>

<Button
android:layout_below="@+id/password_editText"
android:layout_alignRight="@+id/password_editText"
android:layout_alignEnd="@+id/password_editText"
android:layout_marginTop="42dp"
android:id="@+id/btnWithText"
android:layout_width="@dimen/login_fields_with"
android:layout_height="64dp"
android:textColor="@color/grey_100"
android:textSize="18sp"
android:text="@string/login_btn_txt"
android:background="@drawable/button_ripple"/>

</RelativeLayout>
25 changes: 25 additions & 0 deletions app/src/main/res/layout-v10/fragment_section_item_drawer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent">

<Button
android:id="@+id/section_text"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="Section name"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:textAllCaps="false"
android:textSize="16sp"
android:fontFamily="sans-serif-light"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_login_grey600_24dp"
android:drawablePadding="32dp"
tools:ignore="RtlHardcoded"
android:background="@drawable/empty"/>
</FrameLayout>
106 changes: 106 additions & 0 deletions app/src/main/res/layout-v10/fragment_subject_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/subject_item_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:orientation="horizontal"
tools:context="ua.samosfator.moduleok.fragment.last_total_fragment.LastTotalFragment">

<LinearLayout
android:layout_width="match_parent"
android:padding="8dp"
android:layout_height="wrap_content">

<ViewFlipper
android:id="@+id/subject_score_view_flipper"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content">

<TextView
android:id="@+id/subject_score"
android:layout_width="@dimen/score_wrapper_size"
android:layout_height="@dimen/score_wrapper_size"
android:text="75"
android:textColor="@color/textColorPrimary"
android:gravity="center"
android:textSize="22sp"
android:background="@drawable/circle_2" />

<TextView
android:id="@+id/subject_total_score"
android:layout_width="@dimen/score_wrapper_size"
android:layout_height="@dimen/score_wrapper_size"
android:text="75"
android:layout_gravity="center_vertical"
android:textColor="@color/textColorPrimary"
android:gravity="center"
android:textSize="22sp"
android:background="@drawable/circle_2" />
</ViewFlipper>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="16dp"
android:gravity="center_vertical"
tools:ignore="RtlHardcoded,RtlSymmetry">

<TextView
android:id="@+id/subject_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Філософія"
android:singleLine="true"
android:textColor="@color/primary_text_default_material_light"
android:layout_gravity="center_vertical"
android:textSize="20sp" />

<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:paddingLeft="2dp"
android:paddingTop="4dp"
android:layout_height="wrap_content">

<TextView
android:id="@+id/finish_flag"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="-24dp"
android:layout_marginTop="-4dp"/>

<TextView
android:id="@+id/subject_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="02.02.14"
android:textColor="@color/grey_700"
android:layout_gravity="center_vertical" />

<TextView
android:id="@+id/subject_weight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="40%"
android:textColor="@color/grey_500"
android:paddingLeft="8dp"
android:layout_gravity="center_vertical"
android:textSize="14sp" />

<TextView
android:id="@+id/subject_control_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/grey_200"
android:paddingLeft="8dp"
android:layout_gravity="center_vertical"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
File renamed without changes.

0 comments on commit 128e1e9

Please sign in to comment.