Skip to content

Commit

Permalink
modify->设置页面改版,加入小白点功能
Browse files Browse the repository at this point in the history
  • Loading branch information
gumingwei committed Jun 22, 2016
1 parent 8a3bb6c commit ca3ab24
Show file tree
Hide file tree
Showing 41 changed files with 718 additions and 360 deletions.
6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
//compile 'com.google.firebase:firebase-analytics:9.0.0'
// [START gms_compile]
compile 'com.google.android.gms:play-services-analytics:8.4.0'
//compile 'com.google.android.gms:play-services-analytics:8.4.0'
// [END gms_compile]
}
apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.gms.google-services'
7 changes: 6 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<application
android:name=".SwipeApplication"
Expand All @@ -43,6 +43,11 @@
android:launchMode="singleTask"
android:screenOrientation="portrait" />

<activity
android:name=".activitys.SwipeSettingAdvancedActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />

<service android:name=".service.SwipeService" />

<provider
Expand Down
23 changes: 9 additions & 14 deletions app/src/main/java/com/well/swipe/SwipeApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@

import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.ContentObserver;
import android.os.*;
import android.os.Process;
import android.telephony.TelephonyManager;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;
import com.well.swipe.service.SwipeService;

import java.lang.ref.WeakReference;
Expand All @@ -26,11 +21,11 @@ public class SwipeApplication extends Application {
private IconCache mIconCache;

private WeakReference<SwipeProvider> mSwipeProvider;

/**
* GoogleAnlytatic
*/
private Tracker mTracker;

// private Tracker mTracker;
@Override
public void onCreate() {
super.onCreate();
Expand Down Expand Up @@ -84,11 +79,11 @@ public void onChange(boolean selfChange) {
}
};

synchronized public Tracker getDefaultTracker() {
if (mTracker == null) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
mTracker = analytics.newTracker(R.xml.global_tracker);
}
return mTracker;
}
// synchronized public Tracker getDefaultTracker() {
// if (mTracker == null) {
// GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
// mTracker = analytics.newTracker(R.xml.global_tracker);
// }
// return mTracker;
// }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.well.swipe.activitys;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.well.swipe.R;


/**
* Created by mingwei on 6/21/16.
*/
public abstract class BaseSettingActivity extends AppCompatActivity {

private LinearLayout mBaseLayout;

private FrameLayout mContentLayout;

private View mBack;

private TextView mTitle;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBaseLayout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.base_setting_layout, null);
mContentLayout = (FrameLayout) mBaseLayout.findViewById(R.id.base_content);
mBack = mBaseLayout.findViewById(R.id.base_titlebar_back);
mTitle = (TextView) mBaseLayout.findViewById(R.id.base_titlebar_title);
mBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
leftBtnClick();
}
});
}

public void setContentView(int resId) {
View view = LayoutInflater.from(this).inflate(resId, null);
mContentLayout.removeAllViews();
mContentLayout.addView(view);
setContentView(mBaseLayout);
}

public void leftBtnClick() {
finish();
}

public void setTitle(String title) {
mTitle.setText(title);
}

public void setTitle(int titleId) {
mTitle.setText(getResources().getString(titleId));
}

public void isBack(boolean bool) {
if (bool) {
mBack.setVisibility(View.VISIBLE);
} else {
mBack.setVisibility(View.INVISIBLE);
}
}

}
24 changes: 10 additions & 14 deletions app/src/main/java/com/well/swipe/activitys/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
import android.os.*;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;

import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.well.swipe.R;
import com.well.swipe.SwipeApplication;
import com.well.swipe.service.SwipeService;
Expand All @@ -27,7 +23,7 @@ public class SplashActivity extends Activity {

RequestAlertDialog mAlertDialog;

private Tracker mTracker;
//private Tracker mTracker;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -37,7 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {
//Process.killProcess(android.os.Process.myPid());
}
SwipeApplication application = (SwipeApplication) getApplication();
mTracker = application.getDefaultTracker();
//mTracker = application.getDefaultTracker();

if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(this)) {
Expand Down Expand Up @@ -79,21 +75,21 @@ protected void onResume() {
@Override
public void onClick(View v) {
//google anylnitic
mTracker.send(new HitBuilders.EventBuilder()
.setCategory("Action")
.setAction("authorized ALERT_WINDOWS")
.build());
// mTracker.send(new HitBuilders.EventBuilder()
// .setCategory("Action")
// .setAction("authorized ALERT_WINDOWS")
// .build());
startPermission();
mAlertDialog.dissmis();
}
})
.onNegative(new View.OnClickListener() {
@Override
public void onClick(View v) {
mTracker.send(new HitBuilders.EventBuilder()
.setCategory("Action")
.setAction("denied ALERT_WINDOWS")
.build());
// mTracker.send(new HitBuilders.EventBuilder()
// .setCategory("Action")
// .setAction("denied ALERT_WINDOWS")
// .build());
finishSplash();
mAlertDialog.dissmis();
}
Expand Down
Loading

0 comments on commit ca3ab24

Please sign in to comment.